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

allow disabling gzip in http #3231

Closed
jtoppine opened this issue Mar 6, 2023 · 5 comments
Closed

allow disabling gzip in http #3231

jtoppine opened this issue Mar 6, 2023 · 5 comments

Comments

@jtoppine
Copy link

jtoppine commented Mar 6, 2023

Is your feature request related to a problem? Please describe.

Apparently the std http server implementation automagically applies gzip compression for some responses. (I'm guessing for responses that look like highly compressible text files).

While this might be desireable behaviour in most cases, there are some problems:

  • it is hard to debug and test custom server logic under development when the http layer forcibly rewrites (some) responses.
  • it rewrites the etag header, which makes it hard to implement a proper etag-based caching strategy where 304 Not modified response is sent when applicable
  • acting on an deno-generated etag appropriately is hard/impossible without regenerating and re-encoding a response on the server only to see if the client already has a fresh enough cached copy
  • it might possibly interfere with server-side caching strategies where already gzipped responses are stored on the server (although I think there might already be a safety mechanism where already compressed responses are not recompressed).
  • value of gzip encoding is debatable anyway, where in many applications network latency, cache strategy and other factors are way more important than the minor bandwidth savings that come from compressing files in transit. typically the big files are media files or other types that don't compress well.

Describe the solution you'd like

While I personally think http compression should be opt-in and disabled by default. I would be happy to have at least a config option to disable it.

@jtoppine
Copy link
Author

jtoppine commented Mar 6, 2023

Update: Just realized, it appears ETag is not exactly rewritten for gzipped responses - instead, it is prefixed with a weak validation specifier W/. The actual identifier part of etag is left as is. Which feels like exactly correct behaviour, and makes the problem less severe / easy to work around.

I think the issue still stands; ability to disable the compression would be nice.

@ayame113
Copy link
Contributor

ayame113 commented Mar 6, 2023

Response auto-compression is implemented in Deno CLI, not std. Also, the option to disable gzip doesn't seem to exist on purpose. (denoland/deno#13769 (comment))

@kt3k
Copy link
Member

kt3k commented Mar 7, 2023

related denoland/deno#13830

@iuioiua
Copy link
Contributor

iuioiua commented Oct 4, 2023

I think this issue should be closed, as this is a concern with the runtime, not the Standard Library.

@kt3k
Copy link
Member

kt3k commented Oct 5, 2023

Yeah, this is Deno CLI issue, not a std issue. Please track this in denoland/deno#13830

Closing

@kt3k kt3k closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants