title: Azure CDN + Asp.net MVC Cloud Service compression for bundles not working
body: <p>I am using Azure CDN which is pointing to my Azure Cloud Service. I have enabled bundling for my JS and CSS files, and in BundleConfig I have set <code>bundles.UseCdn = true</code>. </p>
  
  <p>Everything is working fine, except that JS &amp; CSS bundles returned via CDN are not compressed. 
  If I am not using CDN, bundles are returned compressed (I can see that Content-Encoding is gzip).</p>
  
  <p>I have enabled compression on my CDN as you can see in pic below:</p>
  
  <p><a href="https://i.stack.imgur.com/S8Xsz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/S8Xsz.png" alt="enter image description here"></a></p>
  
  <p>And in my ASP.net MVC web.config compression is also enabled, and it looks like this:</p>
  
  <pre><code> &lt;urlCompression doStaticCompression="true" doDynamicCompression="true" /&gt;
    &lt;httpCompression&gt;
      &lt;dynamicTypes&gt;
      &lt;clear/&gt;
        &lt;add mimeType="text/*" enabled="true" /&gt;
        &lt;add mimeType="message/*" enabled="true" /&gt;
        &lt;add mimeType="application/x-javascript" enabled="true" /&gt;
        &lt;add mimeType="text/javascript" enabled="true" /&gt;
        &lt;add mimeType="text/css" enabled="true" /&gt;
        &lt;add mimeType="application/json" enabled="true" /&gt;
  
        &lt;!-- HERE --&gt;
        &lt;add mimeType="image/svg+xml" enabled="true" /&gt;
        &lt;add mimeType="image/png" enabled="true" /&gt;
        &lt;add mimeType="image/jpg" enabled="true" /&gt;
        &lt;add mimeType="image/jpeg" enabled="true" /&gt;
        &lt;add mimeType="application/font-woff2" enabled="true" /&gt;
        &lt;add mimeType="application/x-font-ttf" enabled="true" /&gt;
        &lt;add mimeType="application/octet-stream" enabled="true" /&gt;
        &lt;!-- HERE --&gt;
  
        &lt;add mimeType="*/*" enabled="false" /&gt;
      &lt;/dynamicTypes&gt;
      &lt;staticTypes&gt;
      &lt;clear/&gt;
        &lt;add mimeType="text/*" enabled="true" /&gt;
        &lt;add mimeType="message/*" enabled="true" /&gt;
        &lt;add mimeType="application/x-javascript" enabled="true" /&gt;
        &lt;add mimeType="text/javascript" enabled="true" /&gt;
        &lt;add mimeType="text/css" enabled="true" /&gt;
        &lt;add mimeType="application/atom+xml" enabled="true" /&gt;
        &lt;add mimeType="application/xaml+xml" enabled="true" /&gt;
  
        &lt;!-- HERE --&gt;
        &lt;add mimeType="image/png" enabled="true" /&gt;
        &lt;add mimeType="image/jpg" enabled="true" /&gt;
        &lt;add mimeType="image/jpeg" enabled="true" /&gt;
        &lt;add mimeType="application/font-woff2" enabled="true" /&gt;
      &lt;add mimeType="application/x-font-ttf" enabled="true" /&gt;
        &lt;add mimeType="application/octet-stream" enabled="true" /&gt;
        &lt;!-- HERE --&gt;
  
        &lt;add mimeType="*/*" enabled="false" /&gt;
      &lt;/staticTypes&gt;
    &lt;/httpCompression&gt;
  </code></pre>
  
  <p>Interestingly, for same CDN profile (but other endpoint) pictures do have Content-Encoding: gzip, so it seems that compression works fine on CDN also.</p>
  
  <p><a href="https://stackoverflow.com/a/10434390/1284262">This SO answer</a> suggested adding smth. like <code>&amp;group=smth.js</code> at the end of CDN URL, but that din't help.</p>
  
  <p>So what am I doing wrong? </p>