Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure CDN - Enabling HTTP 304 Caching with ETag - Hosted Web Role

We are trying to enable HTTP compression (gzip) and HTTP 304 Caching via ETags on Azure CDN. We already discovered an issue with enabling Azure CDN Compression, but now we can't get compression and ETag caching (304s) working simultaneously. This issue has been posted to Azure forums here.

Here is an example of the compressed, but not HTTP cacheable (304) link:

https://xxxx.vo.msecnd.net/resourceManager.axd?token=HL80vX5hf3lIAAA&group=core.js

Here is an example of the cacheable (304), but not compressible (gzip) link:

https://xxxx.vo.msecnd.net/resourceManager.axd?token=HL80vX5hf3lIAAA&group=core.png

Does anyone know how to get HTTP Caching (304s) and HTTP Compression working together on the Azure CDN?

like image 790
SliverNinja - MSFT Avatar asked May 09 '12 19:05

SliverNinja - MSFT


1 Answers

It is important to know if you are specifying If-None-Match or If-Match? Based on my experience, most users rely on modification date and GET If-Modified-Since.

ETag is stronger if you need to a cache flag for a given entity with multiple encodings, etc.

For your requirement please use Modified/If-Modified-Since and you don't need variable caching based off encodings and this should work.

More info is here: HttpWebResponse LastModified

like image 60
AvkashChauhan Avatar answered Nov 11 '22 09:11

AvkashChauhan