You map the server variable to the full URL, including the domain name. This will not work ;-). It doesn't really matter what the value of Content-Type is, you will replace it anyway so that you can match against anything. To make sure you don’t replace it on every page, you need to add a precondition to match only queries starting with / Feeds / Atom (in {REQUEST_URI}). Here is an example:
<outboundRules> <rule name="AtomFeedsIMEType" preCondition="Match atom feeds"> <match serverVariable="RESPONSE_Content_Type" pattern="(.*)" negate="false" /> <action type="Rewrite" value="application/atom+xml" replace="true" /> </rule> <preConditions> <preCondition name="Match atom feeds"> <add input="{REQUEST_URI}" pattern="^/Feeds/Atom" /> </preCondition> </preConditions> </outboundRules>
To do this, you must configure the server to allow a change in the Content-Type header. This can be done either at the server level or at the site level, but this must be done by the Administrator. It is set in applicationHost.config, not in web.config. Here is the part of applicationHost.config that allows:
<location path="your_site_name"> <system.webServer> <rewrite> <allowedServerVariables> <add name="CONTENT_TYPE" /> </allowedServerVariables> </rewrite> </system.webServer> </location>
You can also enable this from the GUI using the link "View server variables" in action from the URLRewrite main screen. Hope this helps.
source share