Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

IIS has several websites:

  • domain1.com
  • a.domain2.com
  • b.domain2.com

There is also a TomCat running on

localhost:8087

The challenge is how to expose the TomCat externally as

b.domain2.com

What I did:

  • Enabled Proxy in ARR in IIS
  • Added Reverse Proxy URL Rewrite rules on b.domain2.com

    <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>
    

What I see:

Locally if I navigate to

http://b.domain2.com 

my browser shows TomCat website as

http://localhost:8087 

(Why?)

Externally if I navigate in Chrome to

http://b.domain2.com 

it tries to tunnel to

http://localhost:8087

If I navigate in IE it returns 500 error (Fiddler: HTTP/1.1 500 URL Rewrite Module Error.)

Question: What am I doing wrong? Can it be done and how?

share|improve this question
    
This might be better addressed in the SuperUser SE. –  mdpc Dec 20 '12 at 6:07
add comment

1 Answer

Your Action is set to Rewrite so it is rewriting the URL.

In IIS Manager:

  • Right-click Server Farms, click "Create Server Farm". Give it some name.
  • Put the fully-qualified domain name to your Tomcat instance in the "Server name or address" field
  • Click "Advanced settings...", expand "applicationRequestRouting" and change httpPort to 8087
  • Click "Yes" when prompted to create a rewrite rule
  • Click the newly created farm under "Server Farms" in the pane on the left side of the window
  • Open "Routing Rules" on the Server Farm feature view page
  • Click the "URL Rewrite..." link on the right pane
  • Remove the old attempted Tomcat rewrite rule
  • Click "Add Rule(s)..." at the top of the right pane, choose "Blank rule"
  • Give it a name
  • In the Match URL pane:
    • Requested URL: Matches the Pattern
    • Using: Regular Expressions
    • Pattern: *
  • Expand the Conditions pane, click "Add"
    • Condition input: {HTTP_HOST}
    • Check if input string: Matches the pattern
    • Pattern: b.domain2.com
    • Check Ignore Case
  • In the Action pane:
    • Action type: Route to Server Farm
    • Scheme: http://
    • Server farm: (the name of your server farm)
    • Path: {R:1} (NOTE: This may need some tinkering but judging by your example it should work)
  • Click "Apply" on the right pane and your
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.