Refresh an uploaded image with the same name on Akamai Edge Servers

4.6k views Asked by At

I have an application which uploads images on Akamai. Sometimes it is necessary for us to upload the image with the same name as before. When I do this akamai does not refresh the image on edge servers based on the timestamp. However if I rename the image and upload, my changes are reflected on all Edge servers.

Are there any ESI directives that I can use to ensure that the image is refreshed. I know this will beat the purpose of using the CDN but I require this functionality on selected content.

Any help or direction would be great.

2

There are 2 answers

0
Dberg On BEST ANSWER

I believe akamai supports If-Modified-Since/ETAGs which should get you what you want. Looking briefly at the documentation i found the following bullets which should help you.

// From Akamai Documenation //

Make sure that your origin server is sending information that indicates the version of the objects so that the Edge server can send a conditional GET request when those objects expire.

Also make sure that your origin server responds properly to these conditional requests, with a 304 Not Modified, if the file has not changed since the time specified or if the ETag value specified still matches.

Cache-Control and Expires headers instruct the browser on whether and how long to cache an object. But when refreshing an expired object, the browser must have information indicating the version of the object that it can send to the server in a conditional GET request.

Version-specific information commonly available to the browser may include (among others):

Last-Modified: If the browser receives a Last-Modified header with the object when caching it, the browser can then send an If-Modified-Since header when refreshing the object, requesting the server to send the object if it has changed since the date specified or respond with a 304 Not Modified response if it has not. Example, as received in the HTTP response: Last-Modified: Fri, 06 Feb 2009 00:08:43 GMT

ETag: An ETag is a unique string that identifies a specific version of the object. If the browser receives an ETag header with the object, it can send an If-None-Match header when refreshing the object, requesting that the server send the object if its current ETag does not match the ETag in the request or respond with a 304 Not Modified response if it does. Example, as received in the HTTP response: ETag: "4514b5-4824-4743e60ff96c0" Make sure that your site is sending information that indicates the version of the objects so that the browser can send a conditional GET request to the server when those objects expire.

0
robertlbolton On

If an Akamai EdgeSever has the object in cache, it will serve the object without ever checking with origin. When you change the filename, the EdgeServer does not have the object in cache since it views this as a new object (the EdgeServers have a concept of a cache key, which is made up of the filename and some other things. The cache key is how the EdgeServer locates the object in cache).

If you change the object in place on your origin (e.g. you change the contents of the file, but do not change the filename), and an EdgeServer has the object in cache, it will serve it without checking the origin.

If you need to change files in place, you can use the purge mechanism via the Content Control Utility. Log into the web control panel and there is a GUI interface to purge files manually. Or you can use the SOAP API.

If you are constantly changing files and purging becomes an issue, you should look at updating your config. You can set up a low ttl (time to live) for your content, or you can set up a no-store for the content, which will force the EdgeServer to make an If-Modified-Since request back to your origin every time an object is request.