Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shiny & RStudio Server: "Error during WebSocket handshake: Unexpected response code: 404"

I have an instance of RStudio Server (0.98.945) on Ubuntu 12.04.4 LTS. I upgraded to this newest version for the new feature that is supposed to allow you to run Shiny apps within the IDE. On the desktop version, this means RStudio opens a new RStudio window within the app, whereas before it would open a new window in your default web browser; in the previous version of the Server version, if you tried this, you would open a tab within your browser a failed connection.

With RStudio Server (0.98.945), I'm getting half-way to the Desktop experience, where when I run an example:

library(shiny)
runExample("01_hello") 
# this will open a pop-up window that has some content, but closes immediately
runExample("01_hello", launch.browser=interactive())
# this will open a window in a new tab that does not close, but does not
# load any of the shiny.js elements

I get something, but not a working Shiny app.

I can't post a screenshot bc I have no reputation, but basically the app is the "histogram" example. All of the HTML elements seem to load fine, the control widgets load (the bin width adjuster), but the actual image of the histogram does not load. Also, the entire head div has this gray tint.

In the Chrome inspector, the console error that seems to indicate what's going on in this:

WebSocket connection to 'wss://my.company.com/p/3975/websocket/' failed: Error during WebSocket handshake: Unexpected response code: 404.

The resource being cited is shiny.js.

These two links are the closest I can find to a similar problem, but not exactly. Neither have satisfying solutions:

Rstudio and shiny server proxy setting

Websocket - Error during WebSocket handshake: Unexpected response code: 404

EDIT: I just noticed that the error in the Chrome inspector is referencing something a connection called wss://my.company.com/. This reminds me of the kind of thing that might happen if you don't change the default value in some hidden config file. Does anybody know what part of the standard web server stack would throw up this kind of error?

like image 654
jonboiser Avatar asked Jul 15 '14 18:07

jonboiser


1 Answers

You probably should check if adding web socket-specific proxy settings helps:

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

http://nginx.com/blog/websocket-nginx/

like image 52
zzr Avatar answered Sep 17 '22 01:09

zzr