From 7090edc5e74a84aab386d8eab97b185c829fd729 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Mon, 27 Jul 2020 17:16:17 +0200 Subject: [PATCH] cors --- docker/nginx/conf.d/cors.conf | 4 ++++ docker/nginx/conf.d/include/cors | 12 ------------ 2 files changed, 4 insertions(+), 12 deletions(-) create mode 100644 docker/nginx/conf.d/cors.conf diff --git a/docker/nginx/conf.d/cors.conf b/docker/nginx/conf.d/cors.conf new file mode 100644 index 00000000..7fbce3ba --- /dev/null +++ b/docker/nginx/conf.d/cors.conf @@ -0,0 +1,4 @@ +more_set_headers 'Access-Control-Allow-Origin: *'; +more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE'; +more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; +more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range'; \ No newline at end of file diff --git a/docker/nginx/conf.d/include/cors b/docker/nginx/conf.d/include/cors index 33bd2050..fef6d135 100644 --- a/docker/nginx/conf.d/include/cors +++ b/docker/nginx/conf.d/include/cors @@ -12,16 +12,4 @@ if ($request_method = 'OPTIONS') { add_header 'Content-Type' 'text/plain; charset=utf-8'; add_header 'Content-Length' 0; return 204; -} -if ($request_method = 'POST') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; - add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; -} -if ($request_method = 'GET') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; - add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; } \ No newline at end of file