GZip HTTP compression is website and web application performance optimization technique that enables in speeding up website /web application load time. However, developers often struggle to enable compression on dynamic content.
This article will provide a very simple step to enable gZip HTTP compression on dynamic content in Azure
Here is the process;
1. Edit your ServiceDefinition.csdef file to contain this in the WebRole tag:
2. In your web-role, create a text file and save it as “EnableCompression.cmd”
3. EnableCompression.cmd should contain this:
%windir%system32inetsrvappcmd set config /section:urlCompression /doDynamicCompression:True /commit:apphost%windir%system32inetsrvappcmd set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json; charset=utf-8',enabled='True']" /commit:apphost
This simple process will enables dynamic compression for the json returned by the web-role in Azure.