I saw this Question, but it doesn't seem to work for me.
Current (working) situation is:
server { listen 443 ssl; server_name updates.example.com; ssl_certificate fullchain.pem; ssl_certificate_key privkey.pem; location /update { proxy_pass "http://localhost:5000"; proxy_connect_timeout 60; proxy_read_timeout 60; proxy_send_timeout 60; proxy_intercept_errors off; proxy_http_version 1.1; proxy_set_header Host $http_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_set_header X-Client-Subject $ssl_client_s_dn; proxy_set_header X-Client-Cert $ssl_client_cert; } location / { proxy_pass "http://localhost:5001"; proxy_connect_timeout 60; proxy_read_timeout 60; proxy_send_timeout 60; proxy_intercept_errors off; proxy_http_version 1.1; proxy_set_header Host $http_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_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
Now I wanted to add a prefix location to nginx redirect while leaving backend untouched.
Following the above Question's Answers I tried something along the lines:
location /manage { proxy_pass "http://localhost:5001/"; proxy_connect_timeout 60; proxy_read_timeout 60; proxy_send_timeout 60; proxy_intercept_errors off; proxy_http_version 1.1; proxy_set_header Host $http_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_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }
or:
location /manage { rewrite /manage/(.*) /$1 break; proxy_pass "http://localhost:5001"; proxy_redirect off; proxy_connect_timeout 60; proxy_read_timeout 60; proxy_send_timeout 60; proxy_intercept_errors off; proxy_http_version 1.1; proxy_set_header Host $http_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_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }
Actually both those "kind of" work, as the correct page is displayed, but both fail to update it via websocket. I see no error in application, but whatever I do on page does not trigger anything in backend application (a python RemI App). Apparently websocket connection is not carried over correctly.
What am I missing?