After enabling Google minify anything loaded from cache is broken
I have enabled google Minify in code igniter using this library on our website.
When you first view a page that uses a file (css or js) run through the minifier everything loads fine.
However the next time you load the page the files don't load. if you do a ctrl+f5 then the page loads fine, but again, the next time it is broken.
When viewing the file directly you will either get the content, or randomly get a 416 "requested range not satisfiable" error.
I have no idea how to start tracking down the cause of this issue.
Anyone have any ideas?
Header of properly loaded file
Request URL:http://unity.nz.local/css/global.css
Request Method:GET
Status Code:200 OK
Request Headers
Accept:text/css,*/\*;q=0.1
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,en-NZ;q=0.6
Cache-Control:no-cache
Connection:keep-alive
Cookie:ci_unity=[removed]
Host:unity.nz.local
Pragma:no-cache
Referer:http://unity.nz.local/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30
Response Headers
Cache-Control:max-age=2419200, public
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:8884
Content-Type:text/css; charset=utf-8
Date:Fri, 08 Jul 2011 03:10:52 GMT
Expires:Fri, 05 Aug 2011 03:10:52 GMT
Keep-Alive:timeout=15, max=69
Last-Modified:Thu, 07 Jul 2011 22:39:10 GMT
Server:Apache/2.2.17 (Ubuntu)
Vary:Accept-Encoding
X-Powered-By:PHP/5.3.5-1ubuntu7.2
Headers on second load
Request Method:GET
Status Code:200 OK
Request Headers
Accept:text/css,*/\*;q=0.1
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,en-NZ;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
Cookie:ci_unity=[removed]
Host:unity.nz.local
If-Modified-Since:Thu, 07 Jul 2011 22:39:10 GMT
Referer:http://unity.nz.local/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30
Response Headers
Cache-Control:max-age=2419200, public
Connection:Keep-Alive
Content-Encoding:gzi开发者_StackOverflow中文版p
Content-Length:20
Content-Type:text/html
Date:Fri, 08 Jul 2011 03:13:52 GMT
Expires:Fri, 05 Aug 2011 03:13:52 GMT
Keep-Alive:timeout=15, max=69
Last-Modified:Thu, 07 Jul 2011 22:39:10 GMT
Server:Apache/2.2.17 (Ubuntu)
Vary:Accept-Encoding
X-Powered-By:PHP/5.3.5-1ubuntu7.2
_responseCode:HTTP/1.0 304 Not Modified
Also note that the cache files are being created, (although they have a read-only permission). and the content inside them is correct. one thing i did notice is that there is both the file, and a .gz with the same file inside created.
I've had this experience before. It ended up being partly an Apache configuration issue, and partly a browser expectation that gzipped files should end in .gz. You're sending the right Content-Encoding
response header, so I'd try the other thing first.
精彩评论