fix: handle HEAD requests to /identity for iOS app compatibility

This commit is contained in:
2026-04-02 15:37:35 +08:00
parent d2ec622f5a
commit b52e584598

View File

@@ -8,7 +8,7 @@ data:
listen 8080; listen 8080;
server_name _; server_name _;
# Well-known endpoint for Bitwarden clients (multiple variations) # Well-known endpoint for Bitwarden clients
location /.well-known/bitwarden/ { location /.well-known/bitwarden/ {
default_type application/json; default_type application/json;
add_header Content-Type application/json always; add_header Content-Type application/json always;
@@ -23,6 +23,31 @@ data:
return 200 '{"object":"bitwarden-bitwarden-host","api":"https://vaultwarden.lotimmy.com"}'; 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 # Forward all other requests to Vaultwarden
location / { location / {
proxy_pass http://127.0.0.1:80; proxy_pass http://127.0.0.1:80;
@@ -30,8 +55,6 @@ data:
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket support
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";