I am trying to set Amazon CloudFront up with Nginx using W3 Total Cache and WordPress multisite. CloudFront only works with http 1.0 so, I read that you need to change the http version in gzip to 1.0. I made the change but my headers are still using http 1.1. Here is gzip block:
Here is my complete nginx.conf file:
Is there something else I need to change? If I need to provide anymore details please let me know.
Here are the headers.
HTTP/1.1 200 OK => Server => nginx admin Date => Mon, 04 Mar 2013 01:39:33 GMT Content-Type => text/html; charset=UTF-8 Connection => close X-Powered-By => PHP/5.3.21 Expires => Thu, 19 Nov 1981 08:52:00 GMT Cache-Control => no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma => no-cache X-Pingback => http://website.com/xmlrpc.php Set-Cookie => PHPSESSID=c593560b5c75dee9b9c1032416ebbd30; path=/ X-Cache => HIT from Backend
Amazon CloudFront sends an HTTP/1.0 request to your origin server, which causes nginx to refuse to send a gzipped response (by default). Setting
gzip_http_version 1.0; works around this broken behavior in CloudFront. (It’s been 15 years since HTTP/1.1, anything still speaking HTTP/1.0 is fundamentally broken…)
However, once you set it and reload nginx, you also need to invalidate your objects in CloudFront so that new (gzipped) copies will be fetched.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.