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

Don't gzip small responses #186

Closed
filex opened this issue Apr 7, 2021 · 1 comment
Closed

Don't gzip small responses #186

filex opened this issue Apr 7, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@filex
Copy link
Contributor

filex commented Apr 7, 2021

Describe the bug

gzip is means to make a response smaller. However, there is a small overhead for gzip itself making it unsuitable for very small responses.

To Reproduce

  1. Which Couper version? 0.8
  2. Provide your configuration file *.hcl. Remove sensitive data.
server "gzip" {
 endpoint "/" {
  response {
    body =  ""
  }
 }
}
  1. Provide a curl call for reproduction
$ curl --compressed -i http://localhost:8080/
HTTP/1.1 200 OK
Content-Encoding: gzip
Content-Type: text/plain
Server: couper.io
Vary: Accept-Encoding
Date: Wed, 07 Apr 2021 15:59:25 GMT
Content-Length: 23

Couper sends 23 bytes of body (plus 22 bytes for the Content-Encoding header).

Expected behavior

Very small responses like that should not be gzip'ed, regardless of the client's accept-encoding header.

We should use a minimal body length before choosing gzip. 60 bytes could be a good start. If the response to be send is shorter, don't gzip, don't set Content-Encoding: gzip and don't add accept-encoding to the Vary list.

@filex filex added the bug Something isn't working label Apr 7, 2021
@alex-schneider alex-schneider linked a pull request May 10, 2021 that will close this issue
@alex-schneider alex-schneider linked a pull request Jun 9, 2021 that will close this issue
@alex-schneider
Copy link
Contributor

Done with #256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants