My setup looks like this: User->Cloudfront->Nginx->gunicorn

Apparently nginx, doesn't compress (gzip) when there is a CDN inbetween (Via header present) so my nginx sends:

Transfer-encoding: chunked

and according to HTTP/1.1 Content-length is not allowed when it is chunked. Since cloudfront doesn't see content-length header, it doesn't compress neither and my user gets non-compressed responses.

I did

gzip_proxied    no-cache no-store private expired auth;

to make sure nginx compresses even though there is a CDN inbetween but this felt like a hack.. Is my cloudfront configuration wrong, or is it weird that my nginx sends chunked?

What am I doing obviously wrong as the default values result in user getting non-compressed files?

  • 1
    tried gzip_proxied any and do you have gzip on; gzip_disable "msie6"; too? – Antony Gibbs Feb 6 '18 at 21:44
  • It works when I do gzip_proxied but I want to know why default values cause undesired behaviour, I feel like something else is wrong with my setup. Why does nginx send chunked content? is it normal? – EralpB Feb 6 '18 at 21:48
  • Could not confirm you for sure, but chunked is part of http/1.1 and seems normal – Antony Gibbs Feb 6 '18 at 23:21
  • have you looked at those explanations here? stackoverflow.com/questions/5280633/… – Antony Gibbs Feb 6 '18 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.