From d190afd6d525e66587e0f7c46b308de524afb4cc Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Fri, 7 Jun 2024 14:43:52 +0200 Subject: Add www. redirects to pie-in-the-sky.kitchen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- nginx/pie_in_the_sky_kitchen.sls | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nginx/pie_in_the_sky_kitchen.sls b/nginx/pie_in_the_sky_kitchen.sls index a5fbd1e..4f42d5f 100644 --- a/nginx/pie_in_the_sky_kitchen.sls +++ b/nginx/pie_in_the_sky_kitchen.sls @@ -12,8 +12,7 @@ nginx: - location /.well-known/acme-challenge: - root: /srv/http - - location /: - - return: '301 https://$server_name$request_uri' + - rewrite: ^(.*) https://$server_name$1 permanent - server: @@ -55,6 +54,10 @@ nginx: - location /.well-known/acme-challenge: - root: /srv/http + # Redirect www. to non-www. + - "if ($host != $server_name)": + - rewrite: ^(.*) https://$server_name$1 permanent + - location /: - proxy_http_version: '1.1' - proxy_pass: http://127.0.0.1:6344 -- cgit v1.2.3-70-g09d2