From 5bb81eac04f9392c5e8b164fac48f8bb8e10a895 Mon Sep 17 00:00:00 2001 From: Adar Nimrod Date: Sat, 24 Apr 2021 18:32:46 +0300 Subject: [PATCH] Upgrade-Insecure-Requests on www.shore.co.il. Redirect to https only if the client asked. --- conf.d/www.shore.co.il.conf | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/conf.d/www.shore.co.il.conf b/conf.d/www.shore.co.il.conf index f7c0375..820ca33 100644 --- a/conf.d/www.shore.co.il.conf +++ b/conf.d/www.shore.co.il.conf @@ -6,12 +6,26 @@ server { include snippets/ads-txt.conf; include snippets/security-txt.conf; include snippets/www-acme-challenge.conf; - location = / { return 301 https://$host/blog/; } - location /repo/ { - root /var/www/www.shore.co.il/; - autoindex on; + location = $request_uri { include snipptes/upgrade-secure.conf; } + root /var/www/www.shore.co.il/; + error_page 404 /; + + location /repo/ { autoindex on; } + location = /resume { try_files $uri /resume/resume.html; } + location = /resume/ { index resume.html; } + + location = / { return 301 $scheme://$host/blog/; } + location /about { return 301 $scheme://$host/blog/pages/about-me.html; } + location /spam { return 301 $scheme://$host/blog/pages/spam.html; } + location = /blog { + try_files $uri /blog/index.html; + charset UTF-8; } - include snippets/redirect-https.conf; + + location /cgit { return 301 https://git.shore.co.il/explore; } + location /cgit/ { return 301 https://git.shore.co.il/explore; } + location /git { return 301 https://git.shore.co.il/explore; } + location /git/ { return 301 https://git.shore.co.il/explore; } } server { @@ -29,9 +43,9 @@ server { location = /resume { try_files $uri /resume/resume.html; } location = /resume/ { index resume.html; } - location = / { return 301 https://$host/blog/; } - location /about { return 301 https://$host/blog/pages/about-me.html; } - location /spam { return 301 https://$host/blog/pages/spam.html; } + location = / { return 301 $scheme://$host/blog/; } + location /about { return 301 $scheme://$host/blog/pages/about-me.html; } + location /spam { return 301 $scheme://$host/blog/pages/spam.html; } location = /blog { try_files $uri /blog/index.html; charset UTF-8; -- GitLab