开发者

Cache css/js from PHP processor

开发者 https://www.devze.com 2023-01-19 08:12 出处:网络
I\'ve built a php processor to process all my css and js files. The .htaccess rewrites the css and js files to point to the processor.

I've built a php processor to process all my css and js files.

The .htaccess rewrites the css and js files to point to the processor.

The processor gets the contents of the css/js file, processes it and then outputs to the browser.

For some reason the css and js files refuse to cache? I've set the "Expires" and "Cache-Control" headers, but still no luck.

Any suggestions?

Thanks

edit

Here's some of the code:

function setExpires($expires) {  
 header('Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).' GMT');  
 header("Cache-Control: max-age=$expires, public");
 header("Connection: close");
}

I'm using Google Chrome dev tools. The headers coming back are this:

Request URL:http://www.static.do-u-know.net/css/common.1286502074.css
Request Method:GET
Status Code:200 OK

Request Headers
Accept:text/css,*/*;q=0.1
Cache-Control:max-age=0
Referer:http://www.do-u-know.net/frame.php
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrom开发者_高级运维e/6.0.472.63 Safari/534.3

Response Headers
Cache-Control:max-age=631138519, public
Connection:close
Content-Encoding:gzip
Content-Type:text/css
Date:Fri, 08 Oct 2010 02:41:12 GMT
Expires:Mon, 07 Oct 2030 22:56:31 GMT
Server:Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-Powered-By:PHP/5.2.5
0

精彩评论

暂无评论...
验证码 换一张
取 消