title: IIS redirect with cache response header
body: <p>I am trying to develop a "semi-permanent" redirect in IIS 8.5 using a 301 response along with cache expiration header(s), perhaps a max-age or cache-control with a reasonable expiration.  However IIS's URL Rewrite <a href="http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference" rel="nofollow noreferrer">doesn't seem to support</a> adding response headers to a redirect rule.  I see how to affect the cache at a larger scope, <a href="http://www.iis.net/learn/extensions/configuring-application-request-routing-(arr)/manually-override-cache-control-directives-using-application-request-routing" rel="nofollow noreferrer">like this</a>, but not how to apply them to individual redirects.  I.e.:</p>
  
  <pre><code>&lt;rule name="foo" stopProcessing="true"&gt;
    &lt;match url="foo" /&gt;
    &lt;conditions&gt;
      &lt;add input="{URL}" pattern="/foo($|\/$)" /&gt;
    &lt;/conditions&gt;
    &lt;action type="Redirect" url="http://domain.com/full_url_for_now" redirectType="Permanent" someParameterThatLetsMeSetResponseHeaders="max-age:3600"/&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <p>Thanks for any advice.  I'm guessing there's some other way to do this for individual rules/paths/etc., but no luck finding it.  If it's not possible, then I'll have to set the cache parameters at a higher level.</p>
  
  <p>Why: the redirect is for a vanity URL; the path will be the same for a month or two but may change after that.  Straight 301 will <a href="https://stackoverflow.com/questions/9130422/how-long-do-browsers-cache-http-301s">cache permanently</a> in some browsers.  302/307 will cause the the vanity URL to be <a href="https://stackoverflow.com/questions/2467664/do-i-need-to-use-http-redirect-code-302-or-307">indexed</a>, which would mess up my SEO.</p>