From d6f6729c833711fc470123be7d84fbfd77b47f94 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sat, 3 Sep 2022 16:26:12 +0200 Subject: [PATCH] cors? --- nginx/nginx.conf | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index d774516..e82ed66 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -51,8 +51,17 @@ http { server_name "api.cors-school.nilstrieb.dev"; location / { + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' 'cors-school.nilstrieb.dev'; + add_header 'Access-Control-Allow-Credentials' 'true'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, PUT, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'token,refresh-token'; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + proxy_pass http://cors-school-backend:8080/; - add_header Access-Control-Allow-Origin cors-school.nilstrieb.dev; } }