caching - IIS redirect with cache response header -


i trying develop "semi-permanent" redirect in iis 8.5 using 301 response along cache expiration header(s), perhaps max-age or cache-control reasonable expiration. iis's url rewrite doesn't seem support adding response headers redirect rule. see how affect cache @ larger scope, like this, not how apply them individual redirects. i.e.:

<rule name="foo" stopprocessing="true">   <match url="foo" />   <conditions>     <add input="{url}" pattern="/foo($|\/$)" />   </conditions>   <action type="redirect" url="http://domain.com/full_url_for_now" redirecttype="permanent" someparameterthatletsmesetresponseheaders="max-age:3600"/> </rule> 

thanks advice. i'm guessing there's other way individual rules/paths/etc., no luck finding it. if it's not possible, i'll have set cache parameters @ higher level.

why: redirect vanity url; path same month or 2 may change after that. straight 301 cache permanently in browsers. 302/307 cause the vanity url indexed, mess seo.

the cache response header goes in outbound rules:

    <outboundrules>           <rule name="require clients revalidationpermanent redirects">                 <match servervariable="response_cache_control" pattern=".*" />                 <conditions>                     <add input="{response_status}" pattern="301" />                 </conditions>                 <action type="rewrite" value="public, must-revalidate, max-age=0"/>             </rule>      </outboundrules> 

result:

fiddler screenshot:

enter image description here

this avoid horror cannot undone 301 permanent redirects. encourage read excellent article.

with credit http://www.gillsoft.ie/using-url-rewrite-to-improve-your-site-performance-001


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -