【问题标题】:Proxy web socket in shiny server using Apache 2.4使用 Apache 2.4 的闪亮服务器中的代理 Web 套接字
【发布时间】:2016-08-19 13:18:34
【问题描述】:

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

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

这是我当前的配置:

ProxyPreserveHost On
ProxyPassMatch "^/(.+)/websocket" "ws://localhost:3838/$1/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的代理配置引起的。感谢您提供任何修复它的建议。

【问题讨论】:

    标签: r apache proxy websocket shiny-server


    【解决方案1】:

    你见过this吗?它说你的代码应该是这样的:

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

    希望有帮助!

    【讨论】:

    • 感谢您的 cmets。我确实想将我的网址指向我的特定目录。只有 websocket 在我的配置中不起作用。
    • 哦,好的。我会尝试寻找解决方法
    • 我也无法让直接应用链接正常工作。该应用程序加载,但有些缓慢。 ProxyPassMatch 位让我意识到问题的真正所在。谢谢。
    猜你喜欢
    • 2016-06-05
    • 1970-01-01
    • 2017-02-23
    • 2015-11-23
    • 2014-07-26
    • 2020-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多