0

When I go to https://www.something.org:8443 It redirects from my Nginx proxy server to my Proxmox server using the following location settings:

ProxMox Nginx Settings Site

location / {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass https://10.10.0.10:8006/;
    proxy_buffering off;
    client_max_body_size 0;
    proxy_connect_timeout 3600s;
    proxy_read_timeout 3600s;
    proxy_send_timeout 3600s;
    sent_timeout 3600s;
}

The problem is I use my reverse proxy for other paths for other services, so I want it to work when I use the following URL:

https://www.something.org:8443/pve01

But I can't seem to make the location work. I've done three different proxy_pass versions, as shown below.

I get a blank page on all three attempts, but all the scripts and CSS are 404

location /pve01/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    
    1.
    proxy_pass https://10.10.0.10:8006/;
    
    2.
    proxy_pass https://10.10.0.10:8006/$request_uri;
    
    3.
    proxy_pass https://10.10.0.10:8006/;
    rewrite ^/pve01(.*)$ $1 break;
    
    
    proxy_buffering off;
    client_max_body_size 0;
    proxy_connect_timeout 3600s;
    proxy_read_timeout 3600s;
    proxy_send_timeout 3600s;
    sent_timeout 3600s;
}

Any ideas/tips that can help this problem? Thanks

adviner
  • 3,295
  • 10
  • 35
  • 64

1 Answers1

0

I believe the issue lies with the trailing slash, which doesn't pass on the rest of the URL, removing it should do the trick:

location / {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass https://10.10.0.10:8006;
    proxy_buffering off;
    client_max_body_size 0;
    proxy_connect_timeout 3600s;
    proxy_read_timeout 3600s;
    proxy_send_timeout 3600s;
    sent_timeout 3600s;
}

Edit: And if you want only a specific location to be redirected, you could do something like:

location /pve01 {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass https://10.10.0.10:8006;
    proxy_buffering off;
    client_max_body_size 0;
    proxy_connect_timeout 3600s;
    proxy_read_timeout 3600s;
    proxy_send_timeout 3600s;
    sent_timeout 3600s;
}

Removing the trailing slash from both the location and the proxy_pass statement should match any URL starting with the location specified, and should pass the entire URL to the specified proxy_pass IP.

Bets
  • 506
  • 2
  • 12
  • When I try that I get the error: This page isn’t working www.something.org is currently unable to handle this request. HTTP ERROR 501 – adviner Jan 08 '23 at 16:39
  • @adviner I've seen some people say that they had to revise their keepalive_timeout to fix 501 errors. Could you try adding something like "keepalive_timeout 60s;" and see if that helps? – Bets Jan 09 '23 at 09:55
  • I tried it, and its the same affect. Thanks – adviner Jan 10 '23 at 00:55
  • @adviner are all the resources fetched by the service sitting at /pve01/ relative? It's possible the service thinks it's sitting at the root, and is therefore trying to fetch things like /index.js instead of /pve01/index.js - you can open a browser's developer tools and go to the network tab and try to see if the URLs being fetched make sense. – Bets Jan 11 '23 at 11:14