We have files that are over 1mb and excluded from the automatic compression through Azure Verizon CDN.
To accommodate we manually compress the files before uploading to the Azure Blob backbone. We upload both an compressed and uncompressed version of the file.
We have also configured Azure CDN to handle json file :
Now if i curl the blob or cdn with the appropriate headers, I do not get compressed content.
So what is the standard approach to doing this with Azure? Am I missing a setting or header?
Is content swapping not doable based on the Accept-Encoding header?
Do I need to drop the .gz extension and always serve the json zipped?
Any insights would be appreciated.
Edit for clarity:
The recommended solution here is to gzip and upload your asset to blog storage without the .gz extension and make sure it returns the "Content-Encoding:gzip" header.
After that, just request that asset through the CDN endpoint. If your request contains an Accept-Encoding:gzip header, the CDN will return the compressed asset. If your request does not contain the Accept-Encoding header, the CDN will uncompress the file on the fly and serve the client the uncompressed version of the asset.
Original Answer:
Hey, I'm from the Azure CDN team.
First, are you using a Verizon or Akamai profile?
Verizon has a limit of 1MB for edge compression while Akamai does not. Also, this limit is just for CDN edge compression, so if your origin responds with the correct compressed file, the CDN should still serve it to the client.
Blob storage doesn't automatically do content swapping as far as I'm aware.
Note that if an uncompressed version of the file was already cached on the CDN edge, it will continue to serve that file until it expires. You can reset this by using the 'purge' function.
We also have a troubleshooting document here: https://learn.microsoft.com/en-us/azure/cdn/cdn-troubleshoot-compression
I'd be happy to help you troubleshoot further, if the above doesn't help. Just send me your origin and cdn endpoint URLs privately at rli@microsoft.com.