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

假如想象 提交于 2019-12-08 16:55:23

问题


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?


回答1:


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/



来源:https://stackoverflow.com/questions/24765743/shiny-rstudio-server-error-during-websocket-handshake-unexpected-response-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!