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

Content-Encoding: gzip header should not be sent when HTTP 204 #489

Closed
mtojek opened this issue Apr 27, 2016 · 3 comments
Closed

Content-Encoding: gzip header should not be sent when HTTP 204 #489

mtojek opened this issue Apr 27, 2016 · 3 comments
Assignees
Labels

Comments

@mtojek
Copy link
Contributor

mtojek commented Apr 27, 2016

Hi,

nginx warns about empty responses (HTTP 204) with a Content-Encoding header set (based on user request header Accept-Encoding).

I propose to refactor a bit gzipResponseWriter to be sending mentioned header if only HTTP response body is not empty.

Will it be possible, what do you think @vishr ?

Best regards,
Marcin

@vishr
Copy link
Member

vishr commented Apr 27, 2016

Not a problem, just do a quick rfc check and send a PR or even I can do it.

@vishr vishr self-assigned this Apr 27, 2016
@Taik
Copy link

Taik commented May 9, 2016

Sorry I don't have time to send a PR, but according to https://tools.ietf.org/html/rfc7230#section-3.3.1:

   A server MUST NOT send a Transfer-Encoding header field in any
   response with a status code of 1xx (Informational) or 204 (No
   Content).  A server MUST NOT send a Transfer-Encoding header field in
   any 2xx (Successful) response to a CONNECT request (Section 4.3.6 of
   [RFC7231]).

So I think the easiest case is to just follow what @mtojek suggested.

@vishr
Copy link
Member

vishr commented May 9, 2016

@mtojek @Taik Looks like this is already fixed here https://github.com/labstack/echo/blob/master/middleware/compress.go#L62. Can you guys double check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants