XWIKO XWIKO - 7 days ago 6
HTTP Question

Passing Azure CDN Time-To-Live header

I have an web-app endpoint (origin) dispensing files and an Azure CDN (edge server) to distribute the files. In the Azure CDN overview there is a statement:


The origin returns the file to the edge server, including optional HTTP headers describing the file's Time-to-Live (TTL).




I can not seem to find how the header is called that I need to add in order to set the TTL on the file. Does anyone know what it is called?

Thank you.

Answer

There are 2 headers that control the TTL on the file: Expires, and Cache-Control. Expires is the older specification, and Cache-Control is newer and takes precedence.

If one or both are added by the origin, the CDN will honor these values to cache on the CDN edge server.

Theres more step by step info on how to add these headers here: https://docs.microsoft.com/en-us/azure/app-service-web/cdn-websites-with-cdn#configure-caching-options-for-static-files-in-your-azure-web-app