Reputation: 25
Our website uses akamai-CDN to serve images, our origin-server is nginx. In nginx we had initially set the expiry as modified date + 45 days.
location ~* \. (jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|html|htm|txt|css|js|ttf) {
add_header Cache-Control public;
add_header Cache-Control must-revalidate;
expires modified +45d;
}
But after 45 days, in browser we saw something like this:
Cache-Control:public, no-cache, must-revalidate.
Basically the data was not getting cached on the browser side and for each request akamai sends a request to our server.
X-Cache:TCP_IMS_HIT from a203-92-39-77.deploy.akamaitechnologies.com (AkamaiGHost/7.1.0.2-14656242) (-)
So, we changed the nginx conf to expires 45d:
location ~* \.(jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|html|htm|txt|css|js|ttf) {
add_header Cache-Control public;
add_header Cache-Control must-revalidate;
expires 45d;
}
This in affect should see that the akamai cache and browser cache is updated with 45d and hence akamai should not call our server again, but I am still seeing the data not getting cached and akamai status still as:
X-Cache:TCP_IMS_HIT
The only thing I can think of now is that as we have not configured is that as we have not specifically configured the server, when akamai calls the backend server it would be sending the status that file has not changed and hence I should send the status as 200 along with the image. Is my understanding correct? and is there a way to only update the expiry data without sending the complete data.
Thanks, Nitesh
Upvotes: 0
Views: 1430
Reputation: 533
You should check in akamai configuration rather than origin on what the TTL is set to. If its 45days then definitely you should be seeing any request in origin servers.If this is only between akamai and browser then have a look at downstream caching rules in akamai configuration.
Upvotes: 0
Reputation: 1
Are you testing by hitting browser "Refresh" When you hit a browser refresh check the "Request" headers. It will show that browser sends an If-Modified-Since as well as Cache-control : 0 to force reload the objects.
If you are doing the above, the right way to test would be by pressing enter on the browser address bar in which case browser will not send an IMS request header.
Upvotes: 0