【发布时间】:2015-06-11 10:29:13
【问题描述】:
我是前端 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";
}
【问题讨论】:
标签: nginx websocket shiny rstudio