Nginx reverse proxy with query parameters not working

19 Views Asked by At

I am trying to setup a reverse proxy along with the parameter for my backend server. Here is my proxy config:

location /vid {
    proxy_pass https://10.0.0.10:8443/video.html;
    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;
}

location /socket.io/ {
        proxy_pass https://10.0.0.10:8000/$arg_url;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $proxy_host;
        proxy_cache_bypass $http_upgrade;
        client_max_body_size 100M;
    }

it is showing some SSL problems but the certificate is correct as the rest of the application working well.:

2024-03-31T16:58:58.492587700Z 2024/03/31 16:58:58 [error] 31#31: *24 SSL_do_handshake() failed (SSL: error:0A00010B:SSL routines::wrong version number) while SSL handshaking to upstream, client: 192.168.176.1, server: localhost, request: "GET /socket.io/?EIO=3&transport=polling&t=1711904338460-81 HTTP/1.1", upstream: "https://10.0.0.10:8000/", host: "10.0.0.10", referrer: "https://10.0.0.10/vid"

Here is my browser console: enter image description here

I am assuming that /socket.io/ path contains the query param which is not adding up from the proxy server side so the backend server gives the 502 error. I tried to add the $arg_url but still not working. Any idea how to resolve it?

0

There are 0 best solutions below