Compression is now a very common method to improve the file transfer speed and increase page load performance by reducing the file size. The file is compressed just before sending it as a part of response, thus reducing the overall file size.
File compression helps to optimally use the bandwidths and thus helping in reduction of bandwidth costs. Because of reduction in file transfer time, the page load performance is improved, thus helping to improve overall responsiveness and user experience.
In case of Azure CDN, there are two ways to enable compression.
- Enable compression on Origin server. Thus, when Azure CDN would get the compressed the file from the Origin server and when a client asks for that file, CDN would serve the compressed contents
- Another way is to enable compression directly on CDN POP servers. This would enable CDN to compress the files if the file is not already compressed.
In this post, let’s have a look at how to enable compression.
If you have created an Azure CDN using the Standard pricing tier, then the steps from this section would be applicable.
Navigate to the Azure CDN Profile. Then select the endpoint for which the compression needs to be enabled. This would open a new page showing details of endpoint. Then select Compression under Settings. On the compression page, enable the compression by toggling it on.
You can also select the MIME types for which this compression should be enabled. If you want you can also add new MIME types.
The premium tier compression can be enabled from the CDN management portal. Once you open the CDN profile, you would be able to click on the Manage option from the Overview blade. This would take you to the provider specific settings page. You can then enable compression there.
I hope you found this information useful. Let me know your thoughts.