IIS有几个网站:
还有一个TomCat正在运行
localhost:8087
挑战是如何将TomCat外部公开为
b.domain2.com
我做了什么:
在b.domain2.com上添加了反向代理URL重写规则
<rewrite> <rules> <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" /> <action type="Rewrite" url="http://localhost:8087/{R:1}" /> </rule> </rules> <outboundRules> <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" > <match filterByTags="A, Form, Img" pattern="^http(s)?://localhost:8087/(.*)" /> <action type="Rewrite" value="http{R:1}://femiscan.a2itsolutionsllc.com/{R:2}" /> </rule> <preConditions> <preCondition name="ResponseIsHtml1"> <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /> </preCondition> </preConditions> </outboundRules> </rewrite>
我所看到的:
如果我导航到本地
http://b.domain2.com
我的浏览器显示为TomCat网站
http://localhost:8087
(为什么?)
外部如果我在Chrome导航
http://b.domain2.com
它试图通过隧道
http://localhost:8087
如果我在IE中导航,它返回500错误(提琴手:HTTP / 1.1 500 URL重写模块错误。)
问题:我做错了什么? 它可以做,如何?
您的操作设置为重写,因此它正在重写URL。
在IISpipe理器中:
8087 Matches the Pattern Regular Expressions * {HTTP_HOST} Matches the pattern b.domain2.com Ignore Case Route to Server Farm http:// (the name of your server farm) {R:1} ( 注:这可能需要一些修补,但从你的例子来看,它应该工作)