Vaadin 8 + Tomcat 9 + nginx proxy + Websocket + SSL

VERSIONS:

Vaadin Client engine version 8.4.3 Vaadin Server engine version 8.4.3 Vaadin Theme version 8.4.3 Vaadin Push server version 2.4.24.vaadin1 Vaadin Push client version 2.3.2.vaadin1-javascript (note: does not need to match server version)

Tomcat: 9.0.8 nginx: 1.12.2

I have this configuration:

Vaadin 8 application, served via Tomcat 9.

The application has manual push with websocket transport.

If I use the the application served directly from Tomcat, whe Websocket connection works correctly.

Also the upload within the app of 10mb files works.

If I use the application through nginx proxy, the upload works for very small files only (about < 80kb) and the websocket initially works, but after 30 seconds the application hangs (I think the websocket gets closed).

If I comment the upgrade lines in nginx config, the app falls back to long-polling method and works (but it’s slow!).

This is the nginx configuration:

location / {
    proxy_http_version 1.1;
    proxy_pass http://demo/app/;
    proxy_cache demo;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_cookie_path /app /;
    error_page 500 502 503 504 /server_down.html;

    # this lines make websocket work for 30 secs:
    #proxy_set_header Connection $http_connection;
    #proxy_set_header Connection "upgrade";
}

Any help would be appreciated!

Hi,
Would changing the last line to:

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;

work?

-Pontus

Hi Pontus, thank you.

Already tried it, the behaviour is the same.