From e20c522f4510fae89c95a9dd6fba26f379303234 Mon Sep 17 00:00:00 2001 From: cmyui Date: Thu, 8 Aug 2024 08:12:47 +0200 Subject: [PATCH] Maybe fix cors --- sites-enabled/next.conf | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sites-enabled/next.conf b/sites-enabled/next.conf index c5ff21e..ad01a2c 100644 --- a/sites-enabled/next.conf +++ b/sites-enabled/next.conf @@ -34,17 +34,14 @@ server { } location ~ /api/v1/(authenticate|users/(\d+)) { + add_header 'Access-Control-Allow-Origin' $cors_allowed_origin always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'origin, content-type, accept' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + if ($request_method = OPTIONS) { - add_header 'Access-Control-Allow-Origin' $cors_allowed_origin always; - add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'origin, content-type, accept'; - add_header 'Access-Control-Allow-Credentials' 'true'; return 200; } - add_header 'Access-Control-Allow-Origin' $cors_allowed_origin always; - add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'origin, content-type, accept'; - add_header 'Access-Control-Allow-Credentials' 'true'; limit_req zone=users_zone burst=10 nodelay; limit_req_status 429;