Open geraldwuhoo opened 3 years ago
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.
@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.)
@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!
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).