我只需要使用我的web.config实现一个反向代理,而且我在500.52错误方面遇到了问题。正如网上许多地方所建议的那样,我添加了serverVariables部分以包含HTTP_ACCEPT_ENCODING变量,但是遇到了一个错误:
Config错误未识别的元素“serverVariables”
下面是我的web.config。
<rewrite>
<allowedServerVariables>
<add name="HTTP_ACCEPT_ENCODING" />
</allowedServerVariables>
<outboundRules>
<rule name="reverseProxy">
<match pattern="http://linkInCode.com"></match>
<serverVariables>
<set name="HTTP_ACCEPT_ENCODING" value="" />
</serverVariables>
<action type="Rewrite" value="https://linkIWant.com/script.js"></action>
</rule>
</outboundRules>
</rewrite>
有什么问题吗?ServerVariables应该是公认的元素。
发布于 2018-04-25 09:22:15
使用这篇博客文章,我复制了给出的示例,并根据我的需要更改了部分。
<rewrite>
<rules>
<rule name="Rewrite to article.aspx">
<match url="^article/([0-9]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="https://URLtoHide.com" />
</rule>
</rules>
<outboundRules>
<rule name="Rewrite to clean URL" preCondition="IsHTML">
<match filterByTags="A" pattern="http://http://URLtoShow.com" />
<action type="Rewrite" value="https://URLtoHide.com" />
</rule>
<preConditions>
<preCondition name="IsHTML">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
发布于 2018-03-03 01:40:47
您需要先前在<allowedServerVariables>
中注册服务器变量,
https://stackoverflow.com/questions/48152240
复制相似问题