Skip to content

Commit 7628490

Browse files
authored
Update nginx.conf
1 parent 50ae4fb commit 7628490

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

nginx.conf

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,21 @@ http {
1919

2020
client_max_body_size 0;
2121

22-
add_header Access-Control-Allow-Origin $allow_origin;
23-
add_header Access-Control-Allow-Credentials true;
24-
add_header Vary Origin;
22+
# === CORS configuration for ALL locations ===
23+
add_header 'Access-Control-Allow-Origin' $allow_origin always;
24+
add_header 'Access-Control-Allow-Credentials' 'true' always;
25+
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
26+
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-CSRF-Token' always;
27+
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
28+
add_header 'Vary' 'Origin' always;
29+
30+
# Handle preflight OPTIONS requests globally (very important!)
31+
if ($request_method = 'OPTIONS') {
32+
add_header 'Access-Control-Max-Age' 1728000; # Cache preflight for 20 days
33+
add_header 'Content-Type' 'text/plain; charset=utf-8';
34+
add_header 'Content-Length' 0;
35+
return 204; # No Content — standard for preflight
36+
}
2537

2638
location ~ "^/geode/" {
2739
if ($request_method !~ ^(DELETE|GET|POST|PUT|OPTIONS)$) {

0 commit comments

Comments
 (0)