Proxmox access via nginx reverse proxy (no subdomain)

jeanmars

New Member
May 26, 2023
24
2
3
Hi,

I'm new to Proxmox so I may have missed something, I'd like to have an nginx reverse proxy for Proxmox.
I don't want to have a subdomain such as pve.<external address> for that but rather use a subdirectory, i.e.:
https://<external address>/pve --> https://10.10.10.10:8006 to access Proxmox WebUI.

I looked at https://forum.proxmox.com/threads/access-proxmox-via-nginx-reverse-proxy.33332/ but unfortunately there is (was) no solution.

As far as I can see the issue is that the external path /pve is translated to / (local). Unfortunately, on the way back, client still gets / for new requests:
Request#1: https://<external address>/pve/ --> OK (200)
Request#2: https://<external address>/pve2/ext6/ext-all.js?ver=7.0.0 --> KO (501)
Because instead of https://<external address>/pve2/ext6/ext-all.js?ver=7.0.0 it should be https://<external address>/pve/pve2/ext6/ext-all.js?ver=7.0.0 as the entry point for nginx reverse proxy is /pve
I'm no nginx expert but it seems that the way to address this is to use sub_filter directive to force all href and src in the response to include /pve.
This is working OK for static resources but they are some dynamic ones not working with this, here is the outcome:
Capture.GIF
You can see that logo (top left) does not show and more critical Realms combo is empty...
Here is the configuration for nginx:
location /pve {
rewrite ^/pve(.*)$ $1 break;
proxy_pass https://10.10.10.10:8006/;
proxy_redirect https://$proxy_host/ $scheme://$host:$server_port/pve/;
sub_filter 'href="/' 'href="/pve/';
sub_filter 'src="/' 'src="/pve/';
sub_filter_types *;
sub_filter_once off;
sub_filter_last_modified on;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $host;
}

Even if I may find a workaround for this, I'm afraid that much more is coming; so is there anybody who managed to make Proxmox work with a reverse proxy based on subfolder?
One way to address this would be to add to Proxmox WebUI the possibility to have a based URL such as /pve so there would be no such mismatch between external and internal URL (i.e. access Proxmox locally with https://10.10.10.10:8006/pve

Any help appreciated,
Jean
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!