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

Support compression encoding #4

Open
geraldwuhoo opened this issue Jun 7, 2021 · 3 comments
Open

Support compression encoding #4

geraldwuhoo opened this issue Jun 7, 2021 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@geraldwuhoo
Copy link

Unless I am misinterpreting the code and set up my Caddy incorrectly, this module does not support replacing gzip/zstd/etc. compression encoded files. Since most people use Caddyserver as a reverse proxy for services, and many popular services serve gzip-encoded files, this module does not work in the majority of configurations.

Would love if this could be implemented (or even better, if I am misinterpreting the code and this is already supported).

@mholt
Copy link
Member

mholt commented Jun 7, 2021

It works on the raw bytes of the response, regardless of encoding. To manipulate the decoded body, the handler would need a way to be configured to decode the body, perform the replacement, then re-encode.

Open to pull requests.

@mholt mholt added enhancement New feature or request help wanted Extra attention is needed labels Jun 7, 2021
@mholt
Copy link
Member

mholt commented Aug 26, 2021

@francislavoie came up with a clever solution if the encoded content comes from reverse_proxy, using a subdirective:

header_up  Accept-Encoding identity

(Of course, this doesn't help for precompressed static files so much. I guess you could set up an internal file server to serve the static files to which you proxy, and that could work.)

@yroc92
Copy link

yroc92 commented Sep 28, 2021

@francislavoie came up with a clever solution if the encoded content comes from reverse_proxy, using a subdirective:

header_up  Accept-Encoding identity

(Of course, this doesn't help for static files so much. I guess you could set up an internal file server to serve the static files to which you proxy, and that could work.)

I was reverse-proxying to a server I had not control over and wanted to inject javascript into the response by replacing a <script> tag and this header was required to get it to work. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants