apiVersion: v1 kind: ConfigMap metadata: name: nginx-well-known-config data: default.conf: | server { listen 8080; server_name _; # Well-known endpoint for Bitwarden clients location /.well-known/bitwarden/ { default_type application/json; add_header Content-Type application/json always; add_header Access-Control-Allow-Origin * always; return 200 '{"object":"bitwarden-bitwarden-host","api":"https://vaultwarden.lotimmy.com"}'; } location = /.well-known/bitwarden { default_type application/json; add_header Content-Type application/json always; add_header Access-Control-Allow-Origin * always; return 200 '{"object":"bitwarden-bitwarden-host","api":"https://vaultwarden.lotimmy.com"}'; } location /identity/.well-known/bitwarden/ { default_type application/json; add_header Content-Type application/json always; add_header Access-Control-Allow-Origin * always; return 200 '{"object":"bitwarden-bitwarden-host","api":"https://vaultwarden.lotimmy.com"}'; } # Identity endpoints - handle HEAD requests directly location ~ ^/identity { # HEAD requests - return 200 OK directly if ($request_method = HEAD) { add_header Content-Length 0; return 200; } # All other requests - proxy to Vaultwarden proxy_pass http://127.0.0.1:80; 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 $scheme; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } # Forward all other requests to Vaultwarden location / { proxy_pass http://127.0.0.1:80; 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 $scheme; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }