gpt4 book ai didi

nginx - Shiny 的 Websocket 错误

转载 作者:行者123 更新时间:2023-12-03 23:45:24 28 4
gpt4 key购买 nike

我是前端 Web 应用程序开发的新手。我收到如下的 WebSocket 连接失败:

WebSocket connection to 'ws://127.0.0.1:7983/websocket/' failed: Error in connection establishment: net::ERR_EMPTY_RESPONSE

我查了一下这个 WebSocket 错误,发现转移到了以下页面。

Shiny & RStudio Server: "Error during WebSocket handshake: Unexpected response code: 404"

WebSocket connection failed with nginx, nodejs and socket.io

Rstudio and shiny server proxy setting

然后我在我的 Windows 7 机器上下载了 nginx,并在 nginx.conf 中添加了以下注释,保存并执行 runApp()。
location /rstudio/ {
rewrite ^/rstudio/(.*)$ /$1 break;
proxy_pass http://localhost:7983;
proxy_redirect http://localhost:7983/ $scheme://$host/rstudio/;
}

这似乎并没有解决问题。我想我可能需要在 nginx.conf 文件中添加一些额外的内容或将其放在特定目录中。请协助。谢谢!

编辑 nginx.conf 脚本如下:
        location /rstudio/ {
rewrite ^/rstudio/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:5127;
proxy_redirect http://127.0.0.1:5127/ $scheme://$host/rstudio/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

最佳答案

在同一个问题上挣扎了几天后,我发现问题是防火墙阻止了 websocket 工作。我安装了 Pandas Antivirus 并在其中启用了防火墙。当我关闭它并使用 Windows 防火墙并打开该传入端口时,它开始工作。

希望能帮助到你

关于nginx - Shiny 的 Websocket 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29481205/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com