4

I am using the shiny-server (latest version, 1.4.2.786) behind the Apache 2.4, Ubuntu 14.04.

Following the instruction of online documentation (https://support.rstudio.com/hc/en-us/articles/213733868-Running-Shiny-Server-with-a-Proxy), I can setup the proxy correctly for web sockets. However, I would like to point my URL directly a shiny app (not all apps).

This is my current configuration:

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

With this configuration, I still get an error message:

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

I guess this is caused by the configuration of proxy of socket. Thanks for any suggestions to fix it.

1 Answer 1

3
+100

Have you seen this? It says that your code should look like:

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

Hope that helps!

3
  • Thanks for your comments. I do want to point my url into my specific directory. Only the websocket is not working in my configuration.
    – Bangyou
    Commented May 2, 2016 at 23:19
  • oh ok. I'll try look for a fix Commented May 4, 2016 at 19:44
  • I was also having trouble getting direct app link to work appropriately. The app loads, but somewhat sluggishly. That ProxyPassMatch bit made me realize where the problem really lies. Thank you.
    – Yifeng Mu
    Commented Jul 20, 2017 at 1:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.