Skip to content

Firefox, RStudio Server, and latest Shiny/httpuv don't work together #2940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jcheng5 opened this issue Jun 7, 2018 · 0 comments
Closed

Comments

@jcheng5
Copy link
Member

jcheng5 commented Jun 7, 2018

TL;DR: This line doesn't account for the fact that some browsers send Connection: Upgrade and others (Firefox) send Connection: keep-alive, Upgrade.


With the combination of httpuv 1.4.x, RStudio Server, and Firefox, running Shiny apps through the session proxy doesn't work. The problem is fixed if you change ANY of those three though (switching to older httpuv, OR RStudio Desktop, OR Chrome all fix it).

The problem is with the HTTP request that initiates a WebSocket connection, and specifically, with that request's Connection header. Chrome sends Connection: Upgrade, while Firefox sends Connection: keep-alive, Upgrade. RFC 6455 page 17 says:

The request MUST contain a |Connection| header field whose value MUST include the "Upgrade" token.

so both browsers are passing legal values.

However, RStudio Server's proxy logic assumes that the incoming request's Connection header must be equal to "Upgrade" to be considered an upgrade, and if it is not, it changes the header to Connection: close before sending upstream to httpuv.

httpuv <1.4 doesn't care if Connection: close, it allows a websocket connection anyway. That's why it can work with either Firefox or Chrome. But httpuv 1.4.x looks for Connection: Upgrade, so it doesn't work with Firefox.

System details

RStudio Edition : Server
RStudio Version : 1.2.704 and 1.1.453
OS Version      : Ubuntu 16.04
R Version       : 3.4? Doesn't matter

Steps to reproduce the problem

  1. Use Firefox (must be Firefox) to log into RStudio Server
  2. Install Shiny from CRAN (httpuv 1.4.0 or higher must be used)
  3. Start a Shiny app, e.g. shiny::runExample("01_hello"), and let new browser window launch

Describe the problem in detail

The app's page goes grey immediately

Describe the behavior you expected

The app should work correctly

(cc @wch)

jcheng5 added a commit to rstudio/httpuv that referenced this issue Jun 8, 2018
…esent

This is a workaround for rstudio/rstudio#2940. It
stops an erroneously sent "Connection: close" header from breaking an
otherwise legit websocket request.
jcheng5 added a commit to rstudio/httpuv that referenced this issue Jun 8, 2018
…esent

This is a workaround for rstudio/rstudio#2940. It
stops an erroneously sent "Connection: close" header from breaking an
otherwise legit websocket request.
jcheng5 added a commit to rstudio/httpuv that referenced this issue Jun 8, 2018
…esent

This is a workaround for rstudio/rstudio#2940. It
stops an erroneously sent "Connection: close" header from breaking an
otherwise legit websocket request.
@dfalty dfalty added the verified label Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants