IIS 8.5 和 URL 重寫 2.0 是否可以使用 Websocket 反向代理?

IIS 8.5 和 URL 重寫 2.0 是否可以使用 Websocket 反向代理?

我在 IIS 後面安裝了 Tomcat 作為 Java 應用程式伺服器。使用以下規則我可以很好地重寫靜態頁面,但可惜的是,websocket 連線永遠不會建立:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <webSocket enable="false"/>
        <rewrite>
            <rules>
                <rule name="Redirect HTTP to HTTPS" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/foo/{R:1}" redirectType="SeeOther" />
                </rule>
                <rule name="Redirect from IIS to Tomcat" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{CACHE_URL}" pattern="^(.*)://" />
                    </conditions>
                    <action type="Rewrite" url="{C:1}://tomcat.contoso.com/foo/{R:1}" />
                </rule>
            </rules>
            <outboundRules>
                <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}" />
                </rule>
                <preConditions>
                    <preCondition name="ResponseIsHtml">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                    </preCondition>
                </preConditions>
            </outboundRules>
        </rewrite>
    </system.webServer>
</configuration>

有人成功做到這一點嗎? URL 重寫是否支援 websockets (ws:// & wss://) 反向代理?

相關內容