Hello,
I am currently using Nginx to embed a console onto an external webpage. To accomplish this, I am proxying the content to the Proxmox host. Please refer to the Nginx configuration below:
Nginx configuration:
The problem I am experiencing:
With the above Nginx configuration, I can now access the console via an external web page. All calls made by the novnc client work. However, as soon as I make the call to establish the websocket connection, I usually get a 502 bad gateway error after 6 seconds. Occasionally, it is possible to connect to the console, and then the connection is established after 2 seconds. But this occurs at most 2 times out of 10 attempts. Most of the time, the websocket connection is simply not established.
What I have already tried:
My specific question:
Does anyone know why the websocket connection is sometimes established but mostly not? And why it times out after 6 seconds when it fails?
I am currently using Nginx to embed a console onto an external webpage. To accomplish this, I am proxying the content to the Proxmox host. Please refer to the Nginx configuration below:
Nginx configuration:
Code:
server {
listen 80 default_server;
listen [::]:80 default_server;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/ssl/certs/example.com.pem;
ssl_certificate_key /etc/ssl/private/example.com.key;
ssl_session_timeout 1d;
root /var/www/example.com;
index index.html;
location /console/ {
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host proxmox-host.com;
proxy_pass https://proxmox-host.com/;
}
location /api2/json {
proxy_pass https://proxmox-host.com/api2/json;
proxy_http_version 1.1;
proxy_set_header Host proxmox-host.com;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Authorization "PVEAPIToken=TOKEN";
}
location /novnc/ {
proxy_pass https://proxmox-host.com/novnc/;
}
}
The problem I am experiencing:
With the above Nginx configuration, I can now access the console via an external web page. All calls made by the novnc client work. However, as soon as I make the call to establish the websocket connection, I usually get a 502 bad gateway error after 6 seconds. Occasionally, it is possible to connect to the console, and then the connection is established after 2 seconds. But this occurs at most 2 times out of 10 attempts. Most of the time, the websocket connection is simply not established.
What I have already tried:
- Tried setting different headers, such as keep-alive, in the proxy_set_header.
- Checked if Nginx sets a timeout after 6 seconds, but this doesn't seem to be the case.
- Checked the Nginx logs, which indicate that the handshake has failed.
My specific question:
Does anyone know why the websocket connection is sometimes established but mostly not? And why it times out after 6 seconds when it fails?