使用 Apache 2.4 的闪亮服务器中的代理网络套接字

Proxy web socket in shiny server using Apache 2.4

我正在使用 Apache 2.4 背后的闪亮服务器(最新版本,1.4.2.786),Ubuntu 14.04.

按照在线文档 (https://support.rstudio.com/hc/en-us/articles/213733868-Running-Shiny-Server-with-a-Proxy) 的说明,我可以为网络套接字正确设置代理。但是,我想直接将我的 URL 指向一个闪亮的应用程序(不是所有应用程序)。

这是我当前的配置:

ProxyPreserveHost On
ProxyPassMatch "^/(.+)/websocket" "ws://localhost:3838//websocket"
ProxyPass "/" "http://localhost:3838/users/username/appname/"
ProxyPassReverse "/" "http://localhost:3838/users/username/appname/"
ProxyRequests Off

使用此配置,我仍然收到错误消息:

WebSocket connection to 
'wss://my-url/__sockjs__/
n=WxwgyafTMc2bWeH5eR/787/mx9zqt68/websocket' 
failed: Error during WebSocket handshake: 
Unexpected response code: 500

估计是socket的代理配置问题。感谢您提出任何修复建议。

你见过this吗?它说您的代码应该如下所示:

ProxyPreserveHost On
ProxyPassMatch "^/(.+)/websocket" "ws://localhost:3838//websocket"
ProxyPass "/users/username/appname/" "http://localhost:3838/users/username/appname/"
ProxyPassReverse "/users/username/appname/" "http://localhost:3838/users/username/appname/"
ProxyRequests Off

希望对您有所帮助!