From 1fa3316ca1e01a529f0084cd846cc336853d4e57 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 9 Feb 2020 01:48:59 +0000 Subject: fix(web/homepage): Fix redirect setup - all www.* traffic -> non-www - redirect old blog entries without including the port --- web/homepage/nginx.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/homepage/nginx.nix b/web/homepage/nginx.nix index 011f48d51ba9..100c0cc9ee3a 100644 --- a/web/homepage/nginx.nix +++ b/web/homepage/nginx.nix @@ -16,7 +16,7 @@ let oldRedirects = lib.concatStringsSep "\n" (map (post: '' location ~* ^(/en)?/${post.oldKey} { # TODO(tazjin): 301 once this works - return 302 /blog/${post.key}; + return 302 https://tazj.in/blog/${post.key}; } '') (filter (hasAttr "oldKey") blog.posts)); @@ -44,6 +44,7 @@ let server { listen 8080 default_server; + server_name tazj.in; root ${website}; ${oldRedirects} @@ -58,6 +59,12 @@ let try_files $uri $uri.html $uri/ =404; } } + + server { + listen 8080; + server_name www.tazj.in; + return 301 https://tazj.in$request_uri; + } } ''; in writeShellScriptBin "homepage" '' -- cgit 1.4.1