From b7c0865de702b74907cc2527cf9a97266d5a64c0 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Fri, 14 May 2021 21:21:02 +0300
Subject: [PATCH] Give precedence to the acme challenge.

If the acme challenge is in a location block but the default redirection
is not, the default always takes precedence (Nginx won't resolve the
order between the different directives, but it will between different
location blocks).
---
 conf.d/default.conf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/conf.d/default.conf b/conf.d/default.conf
index 6e4eee0..f428ba9 100644
--- a/conf.d/default.conf
+++ b/conf.d/default.conf
@@ -2,12 +2,12 @@ server {
     listen      80 default_server;
     listen      [::]:80 default_server;
     include     snippets/www-acme-challenge.conf;
-    return      301 https://www.shore.co.il$request_uri;
+    location    / { return 301 https://www.shore.co.il$request_uri; }
 }
 
 server {
     listen      443 ssl http2 default_server;
     listen      [::]:443 ssl http2 default_server;
     include     snippets/ssl.conf;
-    return      301 https://www.shore.co.il$request_uri;
+    location    / { return 301 https://www.shore.co.il$request_uri; }
 }
-- 
GitLab