Skip to content

Commit 6d7a704

Browse files
committed
* fix missing CORS headers in the response of api endpoints in be due to https://bugzilla.mozilla.org/show_bug.cgi?id=1751105 @ devenv.nix
1 parent 2615386 commit 6d7a704

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

devenv.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ let
162162
fastcgi_param SCRIPT_FILENAME $request_filename;
163163
# https://serverfault.com/questions/465607/nginx-document-rootfastcgi-script-name-vs-request-filename
164164
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
165+
166+
# https://github.com/monsur/enable-cors.org/commit/ad7acaa164bd551d716b9c1ce9dcf72515236481
167+
add_header 'Access-Control-Allow-Origin' 'https://${cfg.domain}:${toString cfg.port.fe}' always;
168+
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
169+
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
170+
add_header 'Vary' 'Origin' always;
171+
if ($request_method = 'OPTIONS') {
172+
add_header 'Access-Control-Max-Age' 86400;
173+
return 204;
174+
}
165175
}
166176
}
167177
}

0 commit comments

Comments
 (0)