Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Cache-Control: no-transform to disable Cloudflare auto minify #19309

Closed
wxiaoguang opened this issue Apr 2, 2022 · 6 comments · Fixed by #20432
Closed

Use Cache-Control: no-transform to disable Cloudflare auto minify #19309

wxiaoguang opened this issue Apr 2, 2022 · 6 comments · Fixed by #20432
Labels
issue/workaround it is or has a workaround

Comments

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 2, 2022

Many users report that all the tab/space in code disappear. The code indent/indentation become messy.

The reason is that they put Gitea behind Cloudflare, and they enabled the auto minify feature on Cloudflare.

The workaround is to disable the auto minify feature on Cloudflare.

Also, Cloudflare has an option to disable the auto minify: Cache-Control: no-transform

Issues:

Ref:

@wxiaoguang wxiaoguang changed the title Use Cache-Control: no-transform to disable Cloudflare auto minifiy Use Cache-Control: no-transform to disable Cloudflare auto minify Apr 2, 2022
@tankerkiller125
Copy link

Reading through the docs this will also disable gzip/brotli compression, which I don't think is necessarily what you would want to do?

@silverwind
Copy link
Member

Whitespace in HTML is often times significant, I think it's a bug on CF if they remove significant whitespace and break sites that way.

Anyways, I would not be opposed to adding no-transform to text/html responses only.

@wxiaoguang
Copy link
Contributor Author

Reading through the docs this will also disable gzip/brotli compression, which I don't think is necessarily what you would want to do?

It won't be a problem. Gitea has builtin ENABLE_GZIP support.

@zeripath
Copy link
Contributor

zeripath commented Apr 3, 2022

Is it possible that if we use <pre> instead of just relying on CSS pre cloudfare would just do the correct thing?

@wxiaoguang
Copy link
Contributor Author

I have no idea about whether Cloudflare affects the content inside <pre> or <textarea>. I didn't find related documents about this topic.

@silverwind
Copy link
Member

silverwind commented Apr 4, 2022

Is it possible that if we use <pre> instead of just relying on CSS pre cloudfare would just do the correct thing?

Depends on which HTML minfier they are using, but I suspect it might help, but I'm not sure if the introduction of <pre> will break other things. I think we could do a common <pre> ancestor to code view, similar to how GitLab does it. GitHub itself has no <pre> ancestor to their code views so should be affected by this "bug" too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/workaround it is or has a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants