nixos-module: remove proxy-level CORS headers
Laravel's own CORS middleware already sends a complete, correct set of Access-Control-* headers on every response. The nginx and caddy vhost configs were additionally setting a second, static set of the same headers, producing duplicates with conflicting values (e.g. two Access-Control-Allow-Methods headers, one "*" and one the app's real list). Browsers reject responses with duplicate/conflicting CORS headers - curl-based checks never noticed since only browsers enforce CORS header validation, but it broke real browser usage (login/API calls failing silently). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -526,14 +526,6 @@ in
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^(.+)$ /index.php?q= last;
|
||||
}
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' '*';
|
||||
add_header 'Access-Control-Max-Age' 0;
|
||||
add_header 'Content-Length' 0;
|
||||
add_header 'Access-Control-Allow-Headers' 'X-API-COMPANY-KEY,X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Disposition,Content-Type,Range,X-CSRF-TOKEN,X-XSRF-TOKEN,X-LIVEWIRE';
|
||||
add_header 'Access-Control-Expose-Headers' 'X-APP-VERSION,X-MINIMUM-CLIENT-VERSION,X-CSRF-TOKEN,X-XSRF-TOKEN,X-LIVEWIRE';
|
||||
add_header 'Access-Control-Allow-Credentials' false;
|
||||
'';
|
||||
}
|
||||
(lib.mkIf (cfg.hostname != "localhost") {
|
||||
@@ -569,14 +561,6 @@ in
|
||||
encode zstd gzip
|
||||
root ${invoiceninja}/public
|
||||
php_fastcgi unix/${config.services.phpfpm.pools.invoiceninja.socket}
|
||||
header {
|
||||
Access-Control-Allow-Origin "*"
|
||||
Access-Control-Allow-Methods "*"
|
||||
Access-Control-Max-Age "0"
|
||||
Access-Control-Allow-Headers "X-API-COMPANY-KEY,X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Disposition,Content-Type,Range,X-CSRF-TOKEN,X-XSRF-TOKEN,X-LIVEWIRE"
|
||||
Access-Control-Expose-Headers "X-APP-VERSION,X-MINIMUM-CLIENT-VERSION,X-CSRF-TOKEN,X-XSRF-TOKEN,X-LIVEWIRE"
|
||||
Access-Control-Allow-Credentials false
|
||||
}
|
||||
file_server
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user