What's happening?
Let's assume in my Nginx configuration I have the following line:
pagespeed ModifyCachingHeaders offLet's assume the original caching header field for http://www.chtoen.com/css/chtoen.css is the following:
Cache-Control:max-age=2592000When I turn off pagespeed and go to http://www.chtoen.com/css/chtoen.css I see the following HTTP header fields in the response:
Cache-Control:max-age=2592000 Connection:keep-alive Content-Encoding:gzip Content-Type:text/css Date:Mon, 25 Jan 2016 03:31:19 GMT Expires:Wed, 24 Feb 2016 03:31:19 GMT Last-Modified:Sun, 24 Jan 2016 08:53:26 GMT Server:nginx/1.4.6 Transfer-Encoding:chunked Vary:Accept-EncodingI turn on pagespeed and go to http://www.chtoen.com/css/chtoen.css. Here are the HTTP header fields:
Connection:keep-alive Content-Encoding:gzip Content-Type:text/css Date:Mon, 25 Jan 2016 03:43:14 GMT Server:nginx/1.4.6 Transfer-Encoding:chunked Vary:Accept-EncodingIn other words, "pagespeed ModifyCachingHeaders off" is not working for my static CSS file. Why not? Read on to find a solution.
Solution
The solution is easy: Disable certain URLs from processing by PageSpeed module.
I add the following to my Nginx configuration file:
pagespeed Disallow "*.js";
pagespeed Disallow "*.css";
pagespeed Disallow "*.css";
Reload Nginx and here are the HTTP header fields for http://www.chtoen.com/css/chtoen.css:
Cache-Control:max-age=2592000 Connection:keep-alive Content-Encoding:gzip Content-Type:application/x-javascript Date:Mon, 25 Jan 2016 03:44:35 GMT Expires:Wed, 24 Feb 2016 03:44:35 GMT Last-Modified:Sun, 24 Jan 2016 08:53:26 GMT Server:nginx/1.4.6 Transfer-Encoding:chunked Vary:Accept-EncodingAs you can see, PageSpeed module no longer modifies my caching header fields.
Questions? Let me know!