I tend to set up Caddyfile reverse proxy code blocks using this form:
…but this could be simplified to:
Would there be a noticeable impact if
encode gzip is left out of a code block? I sometimes see examples presented without some form of compression included. I was wondering whether it’s okay to leave it out, or is it best practice to leave it in?
It depends whether your proxy upstream compresses the responses itself or not.
If not, then it can help to have it to reduce the amount of data transferred.
If the proxy does already compresses the responses, then
encode will do nothing. Caddy won’t double-encode the response.
Caddy will only encode responses if the client request had a matching
Accepts-Encoding header anyways, so it’s pretty much always safe to have.
This topic was automatically closed after 30 days. New replies are no longer allowed.