mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
The console pages connect to /novncd/ on the address, scheme and port the page itself was loaded from; nginx proxies it to novncd, which listens on the loopback only. There is nothing to configure: the console works on HTTPS (wss), behind another proxy and on any published port. Before, the page connected to WS_PUBLIC_HOST/PORT/PATH, port 6080 by default: straight to novncd, past nginx and without TLS, so an HTTPS panel and a Docker container published on another port had no console until the public port was set by hand, and novncd listened on every interface. Gone: WS_PUBLIC_PORT, WS_PUBLIC_HOST, WS_PUBLIC_PATH and WS_CERT, the installer's two public console questions and its 6080 firewall rule, the Docker image's WS_PUBLIC_PORT and its init script lines, the manual install's firewall rule for 6080 and nginx's unused /websockify location. WS_HOST defaults to 127.0.0.1. A VM with a QEMU websocket port is still reached on that port of the panel's host name (left for a separate decision).
59 lines
1.9 KiB
Text
59 lines
1.9 KiB
Text
# "https" from a TLS-terminating proxy in front of this nginx is kept; otherwise
|
|
# the scheme of this server is used. A client claiming https over plain HTTP
|
|
# only changes how its own request is handled (no redirect, secure cookies).
|
|
map $http_x_forwarded_proto $wvc_forwarded_proto {
|
|
default $scheme;
|
|
https https;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
|
|
#server_name webvirtcloud.example.com;
|
|
#access_log /var/log/nginx/webvirtcloud-access_log;
|
|
|
|
location /static/ {
|
|
alias /srv/webvirtcloud/staticfiles/;
|
|
# URLs carry no version: browsers revalidate (304 if unchanged), so an
|
|
# update or a theme change shows on the next load
|
|
expires -1;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8000;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Forwarded-Proto $wvc_forwarded_proto;
|
|
proxy_connect_timeout 1800;
|
|
proxy_read_timeout 1800;
|
|
proxy_send_timeout 1800;
|
|
client_max_body_size 1024M;
|
|
}
|
|
|
|
location /novncd/ {
|
|
proxy_pass http://wsnovncd;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
# Serial console (socketiod); it refuses connections while
|
|
# SERIAL_CONSOLE_ENABLED is off. Host and the scheme go on for its
|
|
# same-origin check.
|
|
location /socket.io/ {
|
|
proxy_pass http://wssocketiod;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Forwarded-Proto $wvc_forwarded_proto;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_read_timeout 1h;
|
|
}
|
|
}
|
|
|
|
upstream wsnovncd {
|
|
server 127.0.0.1:6080;
|
|
}
|
|
upstream wssocketiod {
|
|
server 127.0.0.1:6081;
|
|
}
|