Azure CDN Adds Pragma: Header Without Cache
I installed Azure CDN using Akamai standard tier. My origin is a web application. I configured the cache control header in my web.config like this:
<clientCache cacheControlMode="UseMaxAge" cacheControlCustom="public" cacheControlMaxAge="30.00:00:00" />
In my markup, I hit my image file with the following code:
<img src="https://xxxx.azureedge.net/Content/Images/Turtle.jpg?v=1.0.0.27987">
When I do this, I get the following response headers:
cache-control:public, max-age=2591903
content-length:2321435
content-type:image/jpeg
date:Mon, 03 Apr 2017 19:34:23 GMT
etag:"2e7a1f1690a9d21:0"
last-modified:Thu, 30 Mar 2017 19:59:05 GMT
pragma:no-cache
server:Microsoft-IIS/8.0 status:200 vary:Accept-Encoding x-powered-by:ASP.NET
Pay attention to the pragma: no-cache. I have no IDEA where this comes from. It is definitely NOT in my origin to load the cache. If I hit the origin, I see the following headers sent for the same image:
Accept-Ranges:bytes
Cache-Control:public,max-age=2592000
Content-Length:2321435
Content-Type:image/jpeg
Date:Mon, 03 Apr 2017 19:41:50 GMT
ETag:"2e7a1f1690a9d21:0"
Last-Modified:Thu, 30 Mar 2017 19:59:05 GMT
Server:Microsoft-IIS/8.0
X-Powered-By:ASP.NET
This means that when you hit the CDN, instead of showing this image from the http cache, it sends an ETag and I'm wasting HTTP feedback. I am guessing the culprit is the pragma: no-cache header that is being sent, which overrides the cache control header. My questions:
- Why does Azure CDN add this pragma: no-cache header when serving my image?
- Is the pragma: no-cache causing us to see a 304 / ETag check instead of serving the http cache?
Thank!
Edit: I've also tried removing the tag from the web.config. I can still see the ETag passed for the image instead of serving it from the browser's http cache.
source to share
No one has answered this question yet
Check out similar questions: