about summary refs log tree commit diff
path: root/web
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-02-09T01·48+0000
committerVincent Ambo <tazjin@google.com>2020-02-09T01·48+0000
commit1fa3316ca1e01a529f0084cd846cc336853d4e57 (patch)
tree6c022b39de8015a190e8daa8d6677410d62d75d0 /web
parent83e99b87e5afc6a79c265f6b1675ba4a9f986efe (diff)
fix(web/homepage): Fix redirect setup r/505
- all www.* traffic -> non-www
- redirect old blog entries without including the port
Diffstat (limited to 'web')
-rw-r--r--web/homepage/nginx.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/web/homepage/nginx.nix b/web/homepage/nginx.nix
index 011f48d51b..100c0cc9ee 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" ''