Hi,
I’m running a self-hosted instance of Bitwarden behind an Nginx reverse-proxy. I’ve read this article and it didn’t help me solve the issue; I’ve tried multiple changes to the configuration but none of them make the connection to Bitwarden work.
I have Nginx reverse-proxy set up to redirect traffic based on the host name in the request header. Below is a working sample of configuration that works and redirects traffic to a Vault instance on port 8200:
# ===============================================
# Vault configuration
# ===============================================
upstream vault_backend {
ip_hash;
server <SERVER_1>:8200 max_fails=1 fail_timeout=2s;
server <SERVER_2>:8200 max_fails=1 fail_timeout=2s;
server <SERVER_3>:8200 max_fails=1 fail_timeout=2s;
keepalive 32;
}
# redirect http to https
server {
listen 8080;
server_name vault.example.com;
return 301 https://$host:8443$request_uri;
}
# reverse proxy to vault backend
server {
listen 8443 ssl http2;
server_name vault.example.com;
ssl_certificate /etc/nginx/security/<CERTIFICATE>.pem;
ssl_certificate_key /etc/nginx/security/<CERTIFICATE_KEY>.key;
proxy_buffering off;
proxy_request_buffering off;
location / {
proxy_pass https://vault_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
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 https;
proxy_buffering off;
proxy_request_buffering off;
proxy_next_upstream error timeout http_429 http_500 http_502 http_503;
proxy_next_upstream_tries 3;
proxy_read_timeout 300s;
proxy_ssl_verify off;
proxy_ssl_server_name on;
}
location = /health {
access_log off;
return 200 "OK\n";
}
}
So, in theory, if I copy the exact same config from above, change the domain name from and port 8200 to 443, it should work.
I know that there are conflicts coming from the fact that Bitwarden has it’s own Nginx running in one of the containers, but I’d like to work around this situation.
Any help & ideas are welcome!
Thanks!