Install and configure Microsoft IIS with Tomcat

  1. Install url-rewrite from https://www.iis.net/downloads/microsoft/url-rewrite.

  2. On IIS management “Enable proxy” from “Server proxy settings.”
  3. Place web.config in inetpub folder.
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <serverVariables>
                            <set name="HTTP_ACCEPT_ENCODING" value="eee" />
                        </serverVariables>
                        <action type="Rewrite" url="http://localhost:8080" />
                    </rule>
                </rules>
                <outboundRules>
                    <rule name="ReverseProxyOutboundRule2" preCondition="ResponseIsHtml1">
                        <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="(.*)" />
                        <action type="Rewrite" value="http://localhost:8080/{R:1}" />
                    </rule>
                    <rule name="RewriteRelativePaths" preCondition="ResponseIsHtml1">
                        <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)" negate="false" />
                        <action type="Rewrite" value="http://localhost:8080/{R:1}" />
                    </rule>
                    <preConditions>
                        <preCondition name="ResponseIsHtml1">
                            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                        </preCondition>
                    </preConditions>
                </outboundRules>
            </rewrite>
        </system.webServer>
    </configuration>
    Note: Replace localhost with system's IP address or name.
  4. Add HTTP_ACCEPT_ENCODING as a server variable in IIS management console.