我在我们的DMZ中有一个反向代理,它将wss请求转换为https(至少从我在IIS日志中可以看到的内容)。也就是说,JavaScript却使一个网页套接字请求通过HTTP的IIS ARR代理WebSockets
wss://cname.domain.com
和反向代理服务器将其发送到
https://theserver.local
IIS的“theserver”正在运行,并且有一个HTTPS绑定。 ARR安装并具有被配置如下重写规则:
<rule name="Rewrite ssl to non-ssl" stopProcessing="true">
<condition logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{CACHE_URL}" pattern="^(.+):// />
</condition>
<match url="the_app/(.*)" />
<action type="Rewrite" url="{MapProtocol:{C:1}}://theserver.local:8080/{R:1}" />
</rule>
<rewriteMap name="MapProtocol">
<add key="https" value="http" />
<add key="wss" value="ws" />
<rewriteMap>
这应该路线HTTPS和WSS传入请求的路径/ the_app到http://theserver:8080/ {path_and_query_string}和WS:// theserver:8080/{分别} path_and_query_string。
我也有以下重写设置(最高优先级)来处理进来通过HTTPS(因为我可以告诉它们所基于的路径),这些WSS请求:
<rule name="Rewrite https to ws" stopProcessing="true">
<match url="the_app/websockets/(%7B.+%7D)" />
<action type="Rewrite" url="ws://theserver:8080/websockets/{R:1}" />
</rule>
的重写完美的作品...但IIS会引发502.2错误尝试将https从ws(无效网关)发送到websockets请求。我打开了失败的请求追踪,似乎无法找到更多相关信息。
可以这样做吗?