1

I have a question regarding gzip. Suppose the server adds the “Content-Encoding: gzip” header. But, the actual content is not gzipped (assuming the compression failed and it is sending the data without compression). What will be the impact of this? How will http clients (especially browsers) handle this?

Thanks, Narendra

1 Answer 1

1

The HTTP specifications state that the Content-Encoding response header specifies the encoding to be used to decode the content. However, it doesn't state what client should do in case of encoding mismatch. So it's up to the clients to decide.

Sign up to request clarification or add additional context in comments.

1 Comment

Chrome for instance will discard the response. (If you load a page that has Content-Encoding: gzip but isn't a valid gzip stream, it will display a generic error message, and the Network tab in the devtools will show the request as "Pending" forever. I assume something similar happens with invalid images/JS/CSS etc.)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.