【发布时间】:2020-12-25 10:47:44
【问题描述】:
我想知道这里是否有人可以提供帮助。我在我的程序中使用了 Nest.js,并且我在我的程序中添加了一些 Web 套接字代码以获得一些新功能。但是,当我部署到服务器时,IIS 设置出现问题。
现在我为我的 http 服务器使用 URL 重写。我的 HTTP 服务器在 localhost 的 8200 端口上运行。我的网络套接字端口是 8085。我测试过的是我可以在本地使用ws://localhost:8085/socket.io/?EIO=3&transport=websocket 和内部网络中的ws://192.168.X.X:8085/socket.io/?EIO=3&transport=websocket 调用它。但是,我不能通过ws://myurl.com/socket.io/?EIO=3&transport=websocket 打电话。 URL 与 IIS 服务器绑定。下面是我的 IIS 服务器 web.config。是不是因为我们的socket不能被url调用?还是我的 web.config 有问题?有人可以帮帮我吗?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WebSocketsReverseProxy" enabled="true" stopProcessing="true">
<match url="ws://(.*)"/>
<action type="Rewrite" url="ws://localhost:8085/{R:1}"/>
</rule>
<rule name="HttpsReverseProxy" stopProcessing="true">
<match url="(.*)"/>
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://"/>
</conditions>
<action type="Rewrite" url="http://localhost:8200/{R:1}"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
【问题讨论】:
标签: web iis websocket socket.io nestjs