My issue: I cannot get two services running behind Nginx Reverse Proxy (RVP for short) to talk to each other while also having the browser to communicate with the backend through the frontend
How I encountered the problem: I’m currently working on a personal project involving proxmox containers, where one container has nginx set as a reverse proxy. The other one is the pterodactyl panel container that will eventually (once everything is known to be stable and working). The PVE has a special NAT to forward the containers ports.
Solutions I’ve tried: setting the node (wings) FQDN in the pterodactyl panel as localhost and the panel to connect to in wings config to be localhost too. Both connect and communicate, but the browser cannot communicate to the node to see and manage the demo servers, for example.
I’ve also tried to just use the dedicated RVP wildcard domain setup for each of them to communicate through, but this what’s failing, and I’m stuck here. I can either have the browser communicating with the panel and potentially the node (at least there are no errors in the console), but then wings cannot run since it cannot connect. Or I can have them both running, and I can’t do anything with the node on the user end.
This is for a demo panel system made using a discord bot btw, if anyone is curious about what i’m making
Version of NGINX or NGINX adjacent software (e.g. NGINX Gateway Fabric):
nginx 1.18.0 on Ubuntu 20.04 LTS x86_64 LXC container
Deployment environment:
This is my config i’m using, and i cannot put on playground since it cannot handle the map things:
# configuration file /etc/nginx/sites-enabled/nebula.conf:
map $host $ip_suffix {
~^nebula([0-9]+)\.demo\.system-breached\.xyz$ $1;
~^node([0-9]+)\.demo\.system-breached\.xyz$ $1;
default 2;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include /nginx/errors;
server_name nebula.demo.system-breached.xyz ~^nebula([0-9]+)\.demo\.system-breached\.xyz$;
ssl_certificate /certificates/demo.system-breached.xyz/fullchain.pem;
ssl_certificate_key /certificates/demo.system-breached.xyz/privkey.pem;
ssl_trusted_certificate /certificates/demo.system-breached.xyz/chain.pem;
client_max_body_size 100M;
proxy_max_temp_file_size 0;
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_redirect off;
proxy_buffering off;
proxy_request_buffering off;
proxy_pass http://10.10.10.$ip_suffix:80;
proxy_read_timeout 3600s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include /nginx/errors;
server_name node.demo.system-breached.xyz ~^node([0-9]+)\.demo\.system-breached\.xyz$;
ssl_certificate /certificates/demo.system-breached.xyz/fullchain.pem;
ssl_certificate_key /certificates/demo.system-breached.xyz/privkey.pem;
ssl_trusted_certificate /certificates/demo.system-breached.xyz/chain.pem;
client_max_body_size 1G;
proxy_max_temp_file_size 0;
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_pass http://10.10.10.$ip_suffix:443;
proxy_read_timeout 3600s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
server {
listen 80;
server_name demo.system-breached.xyz *.demo.system-breached.xyz;
return 301 https://$host$request_uri;
}
# configuration file /nginx/errors:
error_page 404 /custom_404.html;
error_page 500 502 503 504 /custom_50x.html;
location = /custom_404.html {
root /usr/share/nginx/html;
internal;
}
location = /custom_50x.html {
root /usr/share/nginx/html;
internal;
}
If anybody can help me with my issue, but you are missing some information please do not hesitate to ask me for it, it’s my first time asking for support with nginx like this so maybe i forgot some bits, thanks
