Hi to the community at Serverfault!
I have an issue while trying to configure my IIS to open the respective manager APP on two Tomcat Servers on the same machine.
When I call the sites directly via http://servername:8081/manager
and http://servername:8080/manager
(the other Tomcat) respectively, everything is working fine.
The nightmare begins, when I try to redirect the request to http://servername/manager7
to the first Tomcat and http://servername/manager8
to the second server. The links in the HTML Resonse then always contain /manager7/... even if I call the URL http://servername/manager8
.
Below are my rewriting rules. I set them up at server level.
<rewrite>
<globalRules>
<clear />
<rule name="Tomcat7" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*7*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://wwwts02:8081/{R:1}{R:2}" />
</rule>
<rule name="Tomcat8" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*8*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://wwwts02:8080/{R:1}{R:2}" />
</rule>
</globalRules>
<outboundRules>
<clear />
<rule name="Tomcat8" preCondition="Recognize Tomcat8" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match filterByTags="A, Form, Img, Link, Script" pattern="/manager*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
</conditions>
<action type="Rewrite" value="/manager8{R:1}" />
</rule>
<rule name="Tomcat7" preCondition="Recognize Tomcat7" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match filterByTags="A, Form, Img, Link, Script" pattern="/manager*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
</conditions>
<action type="Rewrite" value="/manager7{R:1}" />
</rule>
<preConditions>
<preCondition name="Recognize Tomcat8">
<add input="{REQUEST_URI}" pattern="(.)*/(.*)8/(.*)" />
</preCondition>
<preCondition name="Recognize Tomcat7">
<add input="{REQUEST_URI}" pattern="(.*)/(.*)7(.*)" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
Can anyone think of other options I have?
I also tried the ISAPIRedirect.dll offered by Microsoft, but it seems it doesn't support the rewriting of the HTTP responses at all.
Please direct me, what to try next.
Any help will be greatly appreciated and feel free to ask for further information you need to answer.
Sorry for my probably bad English, as I am German.