Vaultwarden Returned 502 Behind a Reverse Proxy: It Was HTTPS, Not the Network
A reverse proxy returned 502 for Vaultwarden because the backend only speaks HTTPS; checking the protocol first would have saved an hour of firewall debugging.
Problem/symptom
A reverse proxy on the hypervisor returned 502 Bad Gateway for the password-manager hostname, while every other backend worked. From outside the container, http://192.0.2.103:8000/ produced no HTTP response (curl -w '%{http_code}' prints 000). That is not curl’s exit code. The service was clearly listening on 0.0.0.0:8000.
Environment
- Vaultwarden in an unprivileged LXC container on Proxmox
- Nginx reverse proxy on the Proxmox host, hostname-based routing
- Vaultwarden configured with its own TLS (HTTPS on port 8000)
Cause
The backend serves HTTPS only. The proxy was configured with an http:// upstream, so the TLS port received plain HTTP and dropped it. The container firewall and network were never the problem.
Fix step by step
- Test the backend with both schemes from the proxy host:
curl -sk -o /dev/null -w "%{http_code}\n" http://192.0.2.103:8000/ # 000 curl -sk -o /dev/null -w "%{http_code}\n" https://192.0.2.103:8000/ # 200 - Change the upstream to
https://in the proxy config. If the backend uses a self-signed certificate, addproxy_ssl_verify off;or trust the CA properly. - Validate and reload:
nginx -t && systemctl reload nginx.
Lesson/takeaway
Before blaming firewalls or container networking, confirm the protocol. A listening port that answers HTTPS but not HTTP looks exactly like a connectivity failure from the outside.
If you would rather not maintain a reverse proxy and a TLS upstream for Vaultwarden, a hosted manager can take that work. Proton Pass (affiliate link) is one end-to-end encrypted option that handles TLS and hosting.
Spot something wrong or outdated? Leave a comment below. Every comment is reviewed to keep these posts accurate.
By commenting, you agree to our Terms of use and confirm this is your own work. Short quotes are fine with a credit and link. Copied, unsafe, or abusive comments are removed. See something copied? Say so here.