问题
My system is Windows 7 x64, Chrome 20.0.1132.57 m.
In my HTTP response header, I have:
Cache-Control: public, max-age=1000
Expires: *some date*
In IE & FF, the page is cached in local, and when I try to access again by typing the URL and hit enter, no request is send and the page is displayed correctly. But in Chrome, it always send a request to the server with the following header:
Cache-Control: max-age=0
I do not want the client send a request to my server and then reply 304. I want to save the round-trip time.
回答1:
Be carefull when you are testing. I noticed that in Chrome version 20 if I hit F5 to reload the page then in the network panel I see new requests. Hoewer if I place the cursor to the title bar, after the current page url, and hit enter, I get resources from cache, whitch header was set to cache.
Also its better just use the max age. Max age and Expires is the same, but in max age you specify the duration.
See this: http://betterexplained.com/articles/how-to-optimize-your-site-with-http-caching/ Method 3 and Method 4.
回答2:
I had similar problem and I found out that if you make the request with a new chrome tab it will work.
来源:https://stackoverflow.com/questions/11559599/http-expires-header-does-not-work-in-chrome