【发布时间】:2019-09-04 10:59:15
【问题描述】:
我的服务器上运行着一个 ASP.NET Core 2.2 网站
mydomain.com/foo
哪个指向
localhost:83
一切似乎都使用 URL 重写规则重写了:
<outboundRules>
<rule name="ReverseProxyOutboundRule" stopProcessing="false">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^(http)?(s)?(://)?localhost:83/(.*)" />
<action type="Rewrite" value="http{R:1}://mydomain.com/foo/{R:4}" />
</rule>
<rule name="Relative" enabled="true">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)$" />
<action type="Rewrite" value="/foo/{R:1}" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/foo(.?)" />
</conditions>
</rule>
</outboundRules>
几乎所有东西,除了我的<button>:
<button class="btn btn-danger" type="submit" formaction="/dummy/mypage?handler=Delete">Delete</button>
我期望的应该是这样的:
<button class="btn btn-danger" type="submit" formaction="/foo/dummy/mypage?handler=Delete">Delete</button>
我尝试将我的按钮添加为custom tag
<outboundRules>
<rule name="ReverseProxyOutboundRule" stopProcessing="false">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script, CustomTags" customTags="Misc" pattern="^(http)?(s)?(://)?localhost:83/(.*)" />
<action type="Rewrite" value="http{R:1}://mydomain.com/foo/{R:4}" />
</rule>
<rule name="Relative" enabled="true">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script, CustomTags" customTags="Misc" pattern="^/(.*)$" />
<action type="Rewrite" value="/foo/{R:1}" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/foo(.?)" />
</conditions>
</rule>
<customTags>
<tags name="Misc">
<tag name="button" attribute="formaction" />
</tags>
</customTags>
</outboundRules>
但它似乎对我没有任何作用。
我实际上希望 URL 重写能够自动支持 <button> 的重写。
谁能说出这里缺少什么?
更新:
添加了一个我没有看到相关性的相对规则。问题还是一样,我的
<button> 元素上的formaction 没有被重写。
【问题讨论】:
标签: url-rewriting reverse-proxy asp.net-core-2.2 iis-8.5