Wednesday, May 4, 2016

Proxy web socket in shiny server using Apache 2.4

Leave a Comment

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 Answers

Answers 1

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!

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment