1

I am trying to add a expires header to the nginx configuration like this :

    location ~* \.css|\.js|\.jpg|\.jpeg|\.png|\.gif|\.swf|\.svg|\.tiff|\.pdf|\.ico$ 
    {
        expires max;
        add_header Cache-Control "public";
    }

What is expected :
I shouldn't see any line in the network tab of developer console of chrome or firebug for the static content.

But I find that the browser re-requesting the headers always with every request, no matter how you send it. ( with either f5 or loading the link through new tab ) and it comes back with a 304 response code.

Any idea how to make the browser understand that it is not supposed to ask till year 2037??

edit : response/request headers :

Response headers :
Request URL:http://static.shrinath.cm.com/css/maintenance_view.css
Request Method:GET
Status Code:304 Not Modified
Request Headersview source

Request headers :
Accept:text/css,*/*;q=0.1
Accept-Charset:UTF-8,*;q=0.5
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Host:static.shrinath.cm.com
If-Modified-Since:Mon, 18 Jul 2011 08:46:58 GMT
Referer:http://shrinath.cm.com/maintenance
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.1 (KHTML, like Gecko) Ubuntu/11.04 Chromium/14.0.821.0 Chrome/14.0.821.0 Safari/535.1

3
  • Show the response headers .. or better: Would be good to have an online URL to double check
    – LazyOne
    Jul 18, 2011 at 10:41
  • Now clear your local browser cache and try again.
    – symcbean
    Jul 18, 2011 at 12:30
  • :( No, deleting the cache didn't solve it...
    – Shrinath
    Jul 19, 2011 at 5:05

0

You must log in to answer this question.

Browse other questions tagged .