fix(web/homepage): Fix redirect setup

- all www.* traffic -> non-www
- redirect old blog entries without including the port
This commit is contained in:
Vincent Ambo 2020-02-09 01:48:59 +00:00
parent 83e99b87e5
commit 1fa3316ca1

View file

@ -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" ''