From 3a3246dfecab404df90513989bf84a270e17d1f1 Mon Sep 17 00:00:00 2001 From: sijanec Date: Sat, 26 Sep 2020 21:42:10 +0200 Subject: DNM: started lopolisc/untested, added server nginx conf fileas --- server/proxy/zgimsis.conf | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 server/proxy/zgimsis.conf (limited to 'server/proxy/zgimsis.conf') diff --git a/server/proxy/zgimsis.conf b/server/proxy/zgimsis.conf new file mode 100644 index 0000000..72a5974 --- /dev/null +++ b/server/proxy/zgimsis.conf @@ -0,0 +1,51 @@ +# /etc/nginx/sites-enabled/zgimsis +server { + listen 0.0.0.0:80; + listen [::]:80; + server_name .zgimsis.gimb.tk; + return 301 https://zgimsis.gimb.tk/gse/; +} +server { + listen 0.0.0.0:443 http2 ssl; + listen [::]:443 http2 ssl; + ssl_certificate /etc/ssl/sslforfree/gimb.tk.crtca; + ssl_certificate_key /etc/ssl/sslforfree/gimb.tk.key; + server_name .zgimsis.gimb.tk; + location / { + if ($http_origin ~ \.?gimb\.tk$) { + set $cors 'true'; + set $both_conditions "P"; + add_header "x-debug-http-origin-check" "passed"; + } + if ($http_origin ~ \.?beziapp\.github\.io$) { + set $cors 'true'; + set $both_conditions "P"; + add_header "x-debug-http-origin-check" "passed"; + } + if ($cors = 'true') { + add_header "Access-Control-Allow-Origin" $http_origin always; + add_header "Access-Control-Allow-Credentials" "true" always; + add_header "Access-Control-Allow-Methods" "GET, POST, PATCH, PUT, DELETE, OPTIONS" always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always; + add_header 'Access-Control-Expose-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always; + } + if ($request_method = 'OPTIONS') { + set $both_conditions "${both_conditions}D"; + } + if ($both_conditions = PD) { + add_header "Access-Control-Allow-Origin" $http_origin always; + add_header "Access-Control-Allow-Credentials" "true" always; + add_header "Access-Control-Allow-Methods" "GET, POST, PATCH, PUT, DELETE, OPTIONS" always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always; + add_header 'Access-Control-Expose-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always; + add_header 'Access-Control-Max-Age' -1; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + access_log /var/log/nginx/zgimsis/access.log postdata; + proxy_pass https://zgimsis.gimb.org/; + # try_files $uri $uri/ =404; + } +} + -- cgit v1.2.3