Rancher 2 GUI behind nginx proxy



I’m using nginx as proxy to rancher GUI. It seems to work, until i try to download/edit .yml files.
Chrome giving me an error: net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK).

In nginx error log i get:
2019/04/15 11:49:23 [error] 26480#26480: *7 upstream prematurely closed connection while sending to client, client:, server: server.name, request: “GET /v3/project/c-lhfkr:p-mkbzk/pods/default:tomcat-6bb6b8d448-8rnps/yaml HTTP/1.1”, upstream: “”, host: “server.name”, referrer: “https://server.name/p/c-lhfkr:p-mkbzk/workload/deployment:default:tomcat

Here is my nginx conf:

 server {
                listen 443 ssl;
                server_name server.name;

                client_max_body_size 0;
                chunked_transfer_encoding on;

                ssl_certificate /home/ubuntu/.acme.sh/server.name/fullchain.cer;
                ssl_certificate_key /home/ubuntu/.acme.sh/server.name/server.name.key;

                location / {
                        proxy_set_header Host $host;
                        proxy_set_header X-Real-IP $remote_addr;
                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                        proxy_set_header X-Forwarded-Proto $scheme;
                        proxy_http_version 1.1;
                        proxy_set_header Upgrade $http_upgrade;
                        proxy_set_header Connection "Upgrade";
                        proxy_buffering off;


If i open rancher GUI without using proxy - it works. But i believe that “upstream prematurely closed connection” means that rancher server closed connection. What can be done?


I’ve tried the connection “Upgrade” of nginx without ever reach success… (close but no candy) …

you should probably add proxy_read_timeout ####;

I’ved finaly set up an dedicated nginx with the stream module as described in the documentation… and that one work like a charme… I was probably missing a detail,