From a050a83724dbdea220a136814f84f8ab714ca5dd Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Mon, 18 Oct 2021 08:18:50 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Added=20CORS=20headers=20to=20ng?= =?UTF-8?q?inx=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy.conf | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/proxy.conf b/proxy.conf index 5ffd756..010a683 100644 --- a/proxy.conf +++ b/proxy.conf @@ -1,15 +1,25 @@ server { listen 8050; location / { + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent, + X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; + add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH'; + add_header 'Content-Type' 'application/json'; + add_header 'Content-Length' 0; + return 204; + } + + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent, + X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; + add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH'; proxy_pass http://localhost:8050; } } -server { - listen 8051; - location / { - proxy_pass ws://localhost:8051; - } -} + server { listen 3080;