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.

Bangyou
  • 9,462
  • 16
  • 62
  • 94

1 Answers1

3

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!

Community
  • 1
  • 1
Rowan Harley
  • 326
  • 1
  • 3
  • 13
  • 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 May 02 '16 at 23:19
  • oh ok. I'll try look for a fix – Rowan Harley May 04 '16 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 Jul 20 '17 at 01:44