Project

General

Profile

Actions

Task #5105

closed

Enable WebSocket support on nginx for infrastructure gateway

Added by Massimiliano Assante over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
High
Category:
-
Target version:
Start date:
Sep 21, 2016
Due date:
Sep 30, 2016
% Done:

100%

Estimated time:
Infrastructure:
Development, Pre-Production, Production

Description

WebSocket is a protocol providing full-duplex communication channels over a single TCP connection. It basically allows full-duplex communication between clients and server.

Although tomcat 7 supports them, nginx (the reverse proxy) need some further configuration for support ws:// and wss:// (SSL Websocket)

Actions #1

Updated by Massimiliano Assante over 8 years ago

url for testing: wss://next.d4science.org/workspace-6.14.0-SNAPSHOT/downloadfolder

Actions #2

Updated by Andrea Dell'Amico over 8 years ago

RIght now the situation is the following:

  • haproxy already transparently manages the websocket connections
  • nginx needs a couple of options that are
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

Those options cannot be globally set, so we need to find a way to not rewrite the nginx virtualhost every time an app activates the websockets.

Actions #3

Updated by Andrea Dell'Amico over 8 years ago

  • Status changed from New to In Progress
Actions #4

Updated by Andrea Dell'Amico over 8 years ago

  • Status changed from In Progress to Feedback
  • % Done changed from 0 to 100

I've possibly found a generic solution. Now running on dev2.d4science.org.

The details:

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

sets the variable if the client sent the header, empty otherwise. Then, in the virtualhost reverse proxy configuration:

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
Actions #5

Updated by Massimiliano Assante over 8 years ago

so far so good, but I'll wait some days and more testing to close the task

Actions #6

Updated by Andrea Dell'Amico over 8 years ago

  • Status changed from Feedback to Closed

Also verified on the rstudio servers.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 8.91 MB)