我们有ASP.Net MVC应用程序和wso2服务器作为OAuth服务器。我们需要通过一个IP访问这两个IP。我们没有能力使用主机名:(
所以我像这样配置web.config:
<rules>
<rule name="wso2" stopProcessing="true">
<match url="^wso2/(.*)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<serverVariables>
<set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
<set name="HTTP_ACCEPT_ENCODING" value="" />
</serverVariables>
<action type="Rewrite" url="https://some-server:9443/{R:1}" logRewrittenUrl="true" />
</rule>
</rules>
<outboundRules>
<clear />
<rule name="Rewrite Location Header" preCondition="IsRedirection" enabled="true" stopProcessing="false">
<match serverVariable="RESPONSE_Location" pattern="^http://[^/]+/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
<action type="Rewrite" value="https://some-server:8888/wso2/{R:1}" />
</rule>
<rule name="RestoreAcceptEncoding" preCondition="NeedsRestoringAcceptEncoding" enabled="true">
<match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
<action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
</rule>
<rule name="outbound rewrite" preCondition="wso2" enabled="true">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{URL}" pattern="^/oauth2(.*)" />
</conditions>
<action type="Rewrite" value="/wso2/{R:1}" />
</rule>
<preConditions>
<preCondition name="NeedsRestoringAcceptEncoding">
<add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
</preCondition>
<preCondition name="wso2">
<add input="{URL}" pattern="^/wso2/(.*)" />
</preCondition>
<preCondition name="IsRedirection">
<add input="{RESPONSE_STATUS}" pattern="3\d\d" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
当我尝试打开网址时:https://some-server:8888/wso2/carbon/admin/login.jsp它正确打开,例如https://some-server:9443/carbon/admin/login.jsp
但是当我尝试https://some-server:8888/wso2/carbon时,必须重定向到https://some-server:8888/wso2/carbon/admin/login.jsp我才会收到404错误。没有登录appache。 IIS失败的请求日志看起来很好,直到:
36. -PRECONDITION_EVALUATION Verbose
Input {RESPONSE_STATUS}
ExpandedInput 404
MatchType 0
Pattern 3\d\d
Negate false
Succeeded false
MatchType Pattern
但IIS没有问appache(在appache日志和wireshark中没有任何内容)
任何人都知道解决方案吗?