Quantcast
Channel: URL Rewrite Module
Viewing all articles
Browse latest Browse all 2482

URL Rewrite to Multiple Servers Running Tomcat

$
0
0

Hello,

Been searching the web for days on this and have not found a clear answer that matches what I am doing so I thought I would try you all.

Scenario: (Note: To keep it simple for now I am using 1 reverse proxy server. A farm or VIP will be added later)

There will be a wild card DNS called *.sites.domain.com. This way no matter what the URL DNS will give up the IP of the Reverse Proxy server. i.e. newsite.sites.domain.com would resolve without adding a DNS entry for it. On the server there will be 1 IIS site that accepts * as the host header. When a new server is added that needs to be on the internet a Reverse Proxy Rule will be created like the one below so the URL newsite.sites.domain.com will expose server.domain.local to the internet by way of the URL newsite.sites.domian.com.

A bit on the servers being proxied: They are Tomcat 7.0 app servers that are Java based. I just feel like I am missing a bit of config to allow the app server through. I have successfully got the Reverse Proxy working when Tomcat is local so I know it can be done. Now the config calls for Tomcat to be on another server.

Any help and / or guidance would be appreciated!

XML from web.config (modified to use example URLs)

<rewrite>

            <rules>

                <clear />

                <rule name="Newsite.domian.local Inbound" stopProcessing="true">

                    <match url="(.*)" />

                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">

                        <add input="{HTTP_HOST}" pattern="^newsite.sites.domian.com$" />

                    </conditions>

                    <action type="Rewrite" url="https://newsite.domian.local/{R:1}" />

                </rule>

                <rule name="New Site 1 Inbound" stopProcessing="true">

                    <match url="(.*)" />

                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">

                        <add input="{HTTP_HOST}" pattern="^newsite1.sites.domain.com$" />

                    </conditions>

                    <action type="Rewrite" url="http:// newsite1.domain.local /{R:1}" />

                </rule>

                <rule name="new Site 2 Inbound" stopProcessing="true">

                    <match url="(.*)" />

                    <action type="Rewrite" url="http:// newsite2.domain.local/{R:1}" />

                    <conditions>

                        <add input="{HTTP_HOST}" pattern="^newsite2.sites.domain.com$" />

                    </conditions>

                </rule>

            </rules>

            <outboundRules>

                <clear />

                <rule name="Newsite.domian.local Outbound" preCondition="ResponseIsHtml1">

                    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://newsite.domian.local/(.*)" />

                    <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />

                    <action type="Rewrite" value="http{R:1}://newsite.sites.domian.com/{R:2}" />

                </rule>

                <rule name="New Site 1 Outbound" preCondition="ResponseIsHtml1">

                    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link" pattern="^http(s)?://newsite1.domain.local/(.*)" />

                    <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />

                    <action type="Rewrite" value="http{R:1}:// newsite1.sites.domain.com/{R:2}" />

                </rule>

                <rule name="USAWS-SUPPORT3 Outbound" preCondition="ResponseIsHtml1">

                    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://newsite2.domian.local/(.*)" />

                    <action type="Rewrite" value="http{R:1}:// newsite2.sites.domain.com /{R:2}" />

                </rule>

                <preConditions>

                    <preCondition name="ResponseIsHtml1">

                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />

                    </preCondition>

                </preConditions>

            </outboundRules>

            <rewriteMaps>

                <rewriteMap name="RW Map">

                    <add key="newsite.domian.local" value="newsite.sites.domian.com" />

                    <add key="newsite1.domain.com" value="newsite1.sites.domian.com" />

                </rewriteMap>

            </rewriteMaps>

        </rewrite>


Viewing all articles
Browse latest Browse all 2482

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>