nginx's default client_max_body_size is 1 MB, so a phone photo (3-5 MB) uploaded as a product image or customer-display image was refused with 413 before it reached the backend. The proxy (both copies, CS-5) and the waiter, manager and terminal images now allow 250 MB; the backend checks the real limits (media library: 20 MB pictures, 200 MB videos, step 5.1). All five configs pass `nginx -t`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
344 lines
12 KiB
Nginx Configuration File
344 lines
12 KiB
Nginx Configuration File
# Xenia POS — on-site proxy config.
|
|
# install.sh writes this exact file on client sites; nginx-proxy/nginx.conf in the
|
|
# repo is a byte-identical copy. Change both together (global Working Rule 9).
|
|
#
|
|
# :80 waiter.* / manager.* hostnames → redirect to https (legacy domain setup)
|
|
# :80 anything else (bare LAN IP) → waiter app over plain HTTP, LAN only
|
|
# /manager → redirect to :8081
|
|
# :8081 → manager dashboard over plain HTTP, LAN only
|
|
# :8082 → terminal (paired screens: KDS, POS, customer display), LAN only
|
|
# :443 waiter.* / manager.* / bare IP → https (needs certs/cert.pem + key.pem)
|
|
# :4443 → manager over https
|
|
# :8443 → native app over TLS (backend-managed key, pinned), LAN only
|
|
# /api/devices/pair-request on :443 → LAN only (device pairing, D-8)
|
|
#
|
|
# Every proxied location forwards WebSocket upgrades (/api/ws/connect) and
|
|
# disables buffering (SSE), otherwise live events never reach phones / KDS.
|
|
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
|
|
# Uploads: the media library takes pictures up to 20 MB and videos up to 200 MB
|
|
# (local_backend/services/media.py checks the real limits; nginx's default is 1 MB).
|
|
client_max_body_size 250m;
|
|
|
|
# ── Plain HTTP ────────────────────────────────────────────────────────────────
|
|
|
|
server {
|
|
listen 80;
|
|
server_name waiter.* manager.*;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 80 default_server;
|
|
server_name _;
|
|
|
|
# LAN only: plain HTTP must never be reachable from the internet, even if the
|
|
# client forwards ports on their router. Relies on Docker preserving the real
|
|
# client IP (default iptables port publishing on Linux).
|
|
allow 10.0.0.0/8;
|
|
allow 172.16.0.0/12;
|
|
allow 192.168.0.0/16;
|
|
allow 127.0.0.0/8;
|
|
allow fc00::/7;
|
|
allow fe80::/10;
|
|
allow ::1;
|
|
deny all;
|
|
|
|
location ~ ^/manager/?$ {
|
|
return 302 http://$host:8081/;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://waiter_pwa:80;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 8081 default_server;
|
|
server_name _;
|
|
|
|
# LAN only: plain HTTP must never be reachable from the internet, even if the
|
|
# client forwards ports on their router. Relies on Docker preserving the real
|
|
# client IP (default iptables port publishing on Linux).
|
|
allow 10.0.0.0/8;
|
|
allow 172.16.0.0/12;
|
|
allow 192.168.0.0/16;
|
|
allow 127.0.0.0/8;
|
|
allow fc00::/7;
|
|
allow fe80::/10;
|
|
allow ::1;
|
|
deny all;
|
|
|
|
location / {
|
|
proxy_pass http://manager_dashboard:80;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 8082 default_server;
|
|
server_name _;
|
|
|
|
# Terminal app for paired screens (KDS, counter POS, customer display; plan step 3.1b).
|
|
# LAN only: plain HTTP must never be reachable from the internet, even if the
|
|
# client forwards ports on their router. Relies on Docker preserving the real
|
|
# client IP (default iptables port publishing on Linux).
|
|
allow 10.0.0.0/8;
|
|
allow 172.16.0.0/12;
|
|
allow 192.168.0.0/16;
|
|
allow 127.0.0.0/8;
|
|
allow fc00::/7;
|
|
allow fe80::/10;
|
|
allow ::1;
|
|
deny all;
|
|
|
|
# Resolved per request (Docker DNS), so the proxy still starts on a stack that has no
|
|
# terminal container yet (an older docker-compose.yml): only :8082 fails then (502).
|
|
resolver 127.0.0.11 valid=30s ipv6=off;
|
|
set $terminal_upstream http://terminal:80;
|
|
|
|
location / {
|
|
proxy_pass $terminal_upstream;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
# ── HTTPS ─────────────────────────────────────────────────────────────────────
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
server_name waiter.*;
|
|
|
|
ssl_certificate /etc/nginx/certs/cert.pem;
|
|
ssl_certificate_key /etc/nginx/certs/key.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
# Device pairing is LAN-only (APPS_PLATFORM D-8): a device must be in the venue to pair.
|
|
# So is the phone system's call webhook (caller ID, plan step 3.5): only the venue's UCM calls it.
|
|
location ~ ^/api/(devices/pair-request|phone/call-event) {
|
|
allow 10.0.0.0/8;
|
|
allow 172.16.0.0/12;
|
|
allow 192.168.0.0/16;
|
|
allow 127.0.0.0/8;
|
|
allow fc00::/7;
|
|
allow fe80::/10;
|
|
allow ::1;
|
|
deny all;
|
|
proxy_pass http://backend:8000;
|
|
proxy_http_version 1.1;
|
|
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 / {
|
|
proxy_pass http://waiter_pwa:80;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
server_name manager.*;
|
|
|
|
ssl_certificate /etc/nginx/certs/cert.pem;
|
|
ssl_certificate_key /etc/nginx/certs/key.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
# Device pairing is LAN-only (APPS_PLATFORM D-8): a device must be in the venue to pair.
|
|
# So is the phone system's call webhook (caller ID, plan step 3.5): only the venue's UCM calls it.
|
|
location ~ ^/api/(devices/pair-request|phone/call-event) {
|
|
allow 10.0.0.0/8;
|
|
allow 172.16.0.0/12;
|
|
allow 192.168.0.0/16;
|
|
allow 127.0.0.0/8;
|
|
allow fc00::/7;
|
|
allow fe80::/10;
|
|
allow ::1;
|
|
deny all;
|
|
proxy_pass http://backend:8000;
|
|
proxy_http_version 1.1;
|
|
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 / {
|
|
proxy_pass http://manager_dashboard:80;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl default_server;
|
|
server_name _;
|
|
|
|
ssl_certificate /etc/nginx/certs/cert.pem;
|
|
ssl_certificate_key /etc/nginx/certs/key.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
# Device pairing is LAN-only (APPS_PLATFORM D-8): a device must be in the venue to pair.
|
|
# So is the phone system's call webhook (caller ID, plan step 3.5): only the venue's UCM calls it.
|
|
location ~ ^/api/(devices/pair-request|phone/call-event) {
|
|
allow 10.0.0.0/8;
|
|
allow 172.16.0.0/12;
|
|
allow 192.168.0.0/16;
|
|
allow 127.0.0.0/8;
|
|
allow fc00::/7;
|
|
allow fe80::/10;
|
|
allow ::1;
|
|
deny all;
|
|
proxy_pass http://backend:8000;
|
|
proxy_http_version 1.1;
|
|
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 /api/ {
|
|
proxy_pass http://backend:8000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://waiter_pwa:80;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 8443 ssl default_server;
|
|
server_name _;
|
|
|
|
# Encrypted LAN entry for the native app (plan step 7). Key + self-signed cert
|
|
# are created and renewed by the backend (services/tls_identity.py) under
|
|
# ${DATA_PATH}/tls; phones pin the public key, so renewals need no action.
|
|
ssl_certificate /etc/nginx/xenia-tls/cert.pem;
|
|
ssl_certificate_key /etc/nginx/xenia-tls/key.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
# LAN only: plain HTTP must never be reachable from the internet, even if the
|
|
# client forwards ports on their router. Relies on Docker preserving the real
|
|
# client IP (default iptables port publishing on Linux).
|
|
allow 10.0.0.0/8;
|
|
allow 172.16.0.0/12;
|
|
allow 192.168.0.0/16;
|
|
allow 127.0.0.0/8;
|
|
allow fc00::/7;
|
|
allow fe80::/10;
|
|
allow ::1;
|
|
deny all;
|
|
|
|
location / {
|
|
proxy_pass http://waiter_pwa:80;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 4443 ssl default_server;
|
|
server_name _;
|
|
|
|
ssl_certificate /etc/nginx/certs/cert.pem;
|
|
ssl_certificate_key /etc/nginx/certs/key.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
location / {
|
|
proxy_pass http://manager_dashboard:80;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|