Put images on CDN, using MVC3 on IIS7

Viewed 2702

I need to use CDN for all images on my site. So, Ive decided to use IIS Url-rewriting module, because edit manually all my site views - its impossible for me.

So Ive made rules for IIS, eg:

<rule name="cdn1" stopProcessing="true">

   <match url="^Content/Images.*/(.*\.(png|jpeg|jpg|gif))$" />

   <action 
      type="Redirect" 
      url="http://c200001.r9.cf1.rackcdn.com/{ToLower:{R:1}}" 
      redirectType="Permanent" />

</rule>

Its worked, but as you can see there is redirect type is used (301 Permanent). And I think its affects site performance. Maybe it is possible to edit Request.Output to replace image URL?

Please advice, how can I use CDN for images, do not edit my views and avoid redirects?

Any help will be appreciated

2 Answers
Related