I installed Tomcat as a java app server behind IIS. Using the following rules I can rewrite static pages just fine, but alas, websocket connections are never established:

<?xml version="1.0" encoding="UTF-8"?>
        <webSocket enable="false"/>
                <rule name="Redirect HTTP to HTTPS" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTPS}" pattern="^OFF$" />
                    <action type="Redirect" url="https://{HTTP_HOST}/foo/{R:1}" redirectType="SeeOther" />
                <rule name="Redirect from IIS to Tomcat" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{CACHE_URL}" pattern="^(.*)://" />
                    <action type="Rewrite" url="{C:1}://tomcat.contoso.com/foo/{R:1}" />
                <rule name="Redirect from Tomcat to IIS" preCondition="ResponseIsHtml">
                    <match filterByTags="A, Form, Img" pattern="^(.*)://tomcat.contoso.com/foo/(.*)" />
                    <action type="Rewrite" value="{R:1}://apps.contoso.com/foo/{R:2}" />
                    <preCondition name="ResponseIsHtml">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />

Did anybody succeed in this? Does URL rewrite even support websockets (ws:// & wss://) reverse proxy?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.