我设置了一些规则来重写某些urls以使事情更加整洁,但是HTTPS有问题,因为我们的服务器只能通过使用HTTP的负载均衡器访问。负载均衡器添加请求头前端-HTTPS,我想使用它来代替IIS服务器变量{HTTPS}。这个是可能的吗?
类似于:
<rule name="RemoveAspxExtension" enabled="true" stopProcessing="true">
<match url="(.*).aspx$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{URL}" pattern="\.axd$" negate="true" />
<add input="{URL}" pattern="\.aspx/" negate="true" />
<add input="{URL}" pattern="\.asmx" negate="true" />
<add input="{URL}" pattern="\.ashx" negate="true" />
<add input="{URL}" pattern="\.css$" negate="true" />
<add input="{URL}" pattern="\.js$" negate="true" />
<add input="{URL}" pattern="\.png$" negate="true" />
<add input="{URL}" pattern="\.jpg$" negate="true" />
<add input="{URL}" pattern="\.gif$" negate="true" />
<add input="{URL}" pattern="\.xml$" negate="true" />
<add input="{URL}" pattern="\.txt$" negate="true" />
<add input="{URL}" pattern="\.html$" negate="true" />
<add input="{URL}" pattern="/scripts/" negate="true" />
<add input="{URL}" pattern="/styles/" negate="true" />
<add input="{URL}" pattern="/secured/" negate="true" />
</conditions>
<action type="Redirect" url="{MapProtocol:{ToLower:{Front-End-Https}}}://{HTTP_HOST}/{R:1}" appendQueryString="true" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="MapProtocol" defaultValue="http">
<add key="on" value="https" />
<add key="off" value="http" />
</rewriteMap>
</rewriteMaps>发布于 2016-01-13 18:26:45
是的,通过在前面添加一个{HTTP_,您可以使用任何Header,您可以使用{HTTP-前端-Https},而且它应该可以工作。
https://stackoverflow.com/questions/34764019
复制相似问题