websockets 连接超时
websockets connection does time out
我的 Azure WebApp 上的 websockets 出现问题。
我从 github 克隆了 Node-red 并将其发布到 Azure 中的全新 WebApp(使用 VisualStudioOnline)。比我安装所有软件包并使用 grunt 构建解决方案。 (如所述here)
之后我更改了 settings.js 并配置 azure 以支持 websockets。 (如所述here)。
但是 websockets 仍然不工作:
Chrome 确实显示以下错误:
Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
我在服务器端看不到任何表明问题的 Logs/Warnings。
请注意以下几点,在您的申请中修改后再试。
- 首先尝试通过 https://github.com/node-red/node-red#developers 在本地 运行 node-red 应用程序。特别是 运行 命令
grunt build
来完成你的申请。
尝试删除忽略文件夹
coverage
credentials.json
flows*.json
nodes/node-red-nodes/
node_modules
public
locales/zz-ZZ
nodes/core/locales/zz-ZZ
在.gitignore
中,然后在Azure上部署妓女完成的项目。
修改settings.js
文件中的uiPort: process.env.PORT || 1880,
。
如有任何疑问,请随时告诉我。
问题源于我们的代理。 Here 是描述问题的 Post。
If an unencrypted WebSocket connection (ws://) is used, then in the case of transparent proxy servers, the browser is unaware of the proxy server, so no HTTP CONNECT is sent. As a result, the connection is almost likely to fail in practice today.
If an encrypted WebSocket Secure connection (wss://) is used, then in the case of transparent proxy servers, the browser is unaware of the proxy server, so no HTTP CONNECT is sent. However, since the wire traffic is encrypted, intermediate transparent proxy servers may simply allow the encrypted traffic through, so there is a much better chance that the WebSocket connection will succeed if an encrypted WebSocket connection is used.
因此,我只是使用以下重写规则强制重定向到 HTTPS 站点 (web.config)
<rule name="https redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
然后一切都按预期进行。
我的 Azure WebApp 上的 websockets 出现问题。
我从 github 克隆了 Node-red 并将其发布到 Azure 中的全新 WebApp(使用 VisualStudioOnline)。比我安装所有软件包并使用 grunt 构建解决方案。 (如所述here)
之后我更改了 settings.js 并配置 azure 以支持 websockets。 (如所述here)。
但是 websockets 仍然不工作: Chrome 确实显示以下错误:
Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
我在服务器端看不到任何表明问题的 Logs/Warnings。
请注意以下几点,在您的申请中修改后再试。
- 首先尝试通过 https://github.com/node-red/node-red#developers 在本地 运行 node-red 应用程序。特别是 运行 命令
grunt build
来完成你的申请。 尝试删除忽略文件夹
coverage credentials.json flows*.json nodes/node-red-nodes/ node_modules public locales/zz-ZZ nodes/core/locales/zz-ZZ
在
.gitignore
中,然后在Azure上部署妓女完成的项目。修改
settings.js
文件中的uiPort: process.env.PORT || 1880,
。
如有任何疑问,请随时告诉我。
问题源于我们的代理。 Here 是描述问题的 Post。
If an unencrypted WebSocket connection (ws://) is used, then in the case of transparent proxy servers, the browser is unaware of the proxy server, so no HTTP CONNECT is sent. As a result, the connection is almost likely to fail in practice today.
If an encrypted WebSocket Secure connection (wss://) is used, then in the case of transparent proxy servers, the browser is unaware of the proxy server, so no HTTP CONNECT is sent. However, since the wire traffic is encrypted, intermediate transparent proxy servers may simply allow the encrypted traffic through, so there is a much better chance that the WebSocket connection will succeed if an encrypted WebSocket connection is used.
因此,我只是使用以下重写规则强制重定向到 HTTPS 站点 (web.config)
<rule name="https redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
然后一切都按预期进行。