From 54f17cc4f2a4be2d07071dce9c3227b199f32745 Mon Sep 17 00:00:00 2001 From: "Guillaume \"B.B.\" Van Hemmen" Date: Mon, 21 Oct 2024 10:25:13 +0200 Subject: [PATCH] #0000 - Reorganize and enhance the NGINX configuration structure Introduce a refined NGINX configuration template with user, worker settings, and modular include directives. This improves clarity and allows easier integration of additional configuration files, while maintaining existing CORS settings. --- nginx-extra.conf | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/nginx-extra.conf b/nginx-extra.conf index 71230cc..e77cbe4 100644 --- a/nginx-extra.conf +++ b/nginx-extra.conf @@ -1,18 +1,21 @@ -location / { - # other settings... - # Allow CORS for all domains (or specify a particular domain instead of *) - add_header 'Access-Control-Allow-Origin' '*'; - # Allow specific headers - add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization'; - # Allow specific methods - add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; - if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; - add_header 'Access-Control-Max-Age' 1728000; - add_header 'Content-Type' 'text/plain; charset=utf-8'; - add_header 'Content-Length' 0; - return 204; - } +server { + listen 80; + location / { + # other settings... + # Allow CORS for all domains (or specify a particular domain instead of *) + add_header 'Access-Control-Allow-Origin' '*'; + # Allow specific headers + add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization'; + # Allow specific methods + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain; charset=utf-8'; + add_header 'Content-Length' 0; + return 204; + } + } }