project-pegaprox icon indicating copy to clipboard operation
project-pegaprox copied to clipboard

[Bug] Proxmox VM VNC console fails to connect due to duplicate Host header

Open ralphys opened this issue 3 weeks ago • 2 comments

Hey there! 👋 Thanks for taking the time to report this bug — we appreciate it!

Please keep in mind: PegaProx is developed and maintained entirely by volunteers in our free time. We do our best, but we can't work magic 🪄 — please be patient, we'll get to your issue as soon as we can.

Want to help keep PegaProx alive?

  • ⭐ [Star the project](https://github.com/PegaProx/project-pegaprox) — it's free and helps a lot!
  • 💖 [Become a Sponsor](https://pegaprox.com/#sponsor) — helps us dedicate more time to development
  • 🤝 Contributing code or docs is always welcome too!

PegaProx Version:1.4.1

Docker image: ghcr.io/pegaprox/pegaprox:1.4.1

Steps to Reproduce

  1. Deploy PegaProx using the official Docker image.
  2. Configure a Proxmox VE 9.x cluster.
  3. Log in to the PegaProx web interface.
  4. Navigate to a VM hosted on the Proxmox cluster.
  5. Open the VM's VNC console.
  6. Observe that the console fails to connect and closes immediately.

Expected behavior:

The VM's VNC console should open normally and display the VM screen.

Actual behavior:

The console fails to connect. The browser console displays:

Failed when connecting: Connection closed (code: 1000)

Describe the bug

I was having trouble opening the VNC console for Proxmox VMs through PegaProx 1.4.1.

The PegaProx web interface worked normally, and I could access the VM details, but opening a VM's console would fail.

The Nginx reverse proxy was successfully establishing the WebSocket connection with PegaProx (HTTP 101), so the problem wasn't with Nginx or the browser-to-PegaProx connection.

Root cause

After checking the PegaProx logs and source code, I found the following error:

WebSocketBadStatusException:
Handshake status 400 invalid duplicate header

The issue appears to be in:

/app/pegaprox/api/vms.py

Inside the _pve_console_ws_auth() function, the code initializes the headers with:

headers = {"Host": netloc}

However, the websocket-client library automatically generates the Host header from the WebSocket URL. Supplying it manually results in a duplicate Host header.

Proxmox rejects the WebSocket handshake with HTTP 400 because of this duplicate header.

Proposed fix

Replace:

headers = {"Host": netloc}

with:

headers = {}

The rest of the function can remain unchanged. The Cookie and Authorization headers are still added as needed.

Result

I built a custom Docker image with this one-line change and deployed it in place of the original PegaProx 1.4.1 image.

After restarting the container, the Proxmox VNC console connected successfully.

This confirms that removing the manually supplied Host header resolves the issue in my environment.

Environment

  • PegaProx: 1.4.1
  • Proxmox VE: 9.x
  • Deployment: Docker
  • Reverse proxy: Nginx
  • Browsers tested: Firefox and Brave

Hopefully this helps identify and fix the issue in an upcoming release so other users don't run into the same problem.

Thanks for the work on PegaProx!

ralphys avatar Nov 09 '26 07:11 ralphys

👋 Thanks for reporting a bug!

Unfortunately, it looks like some required information is missing.

Please provide:

  • [ ] Steps to Reproduce
  • [ ] PegaProx Version

Why? We are volunteers maintaining PegaProx in our free time. Complete bug reports help us fix issues faster. 🐾

Closing for now — please reopen with the required details or open a new issue.

This is an automated message.

github-actions[bot] avatar Nov 09 '26 07:11 github-actions[bot]

👋 Thanks for reporting a bug!

Unfortunately, it looks like some required information is missing.

Please provide:

  • [ ] PegaProx Version

Why? We are volunteers maintaining PegaProx in our free time. Complete bug reports help us fix issues faster. 🐾

Closing for now — please reopen with the required details or open a new issue.

This is an automated message.

github-actions[bot] avatar Nov 09 '26 07:11 github-actions[bot]