The code and data behind xeiaso.net
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

site update: new domain

Signed-off-by: Xe Iaso <me@christine.website>

Xe Iaso 7c7904c1 7cf1429a

+125
+125
blog/big-domain-move.markdown
··· 1 + --- 2 + title: "Site Update: The Big Domain Move To xeiaso.net" 3 + date: 2022-05-28 4 + tags: 5 + - dns 6 + --- 7 + 8 + Hello all! 9 + 10 + If you take a look in the URL bar of your browser (or on the article URL section 11 + of your feed reader), you should see that there is a new domain name! Welcome to 12 + [xeiaso.net](https://xeiaso.net)! 13 + 14 + Hopefully nothing broke in the process of moving things over, I tried to make 15 + sure that everything would forward over and today I'm going to explain how I did 16 + that. 17 + 18 + I have really good SEO on my NixOS articles, and for my blog in general. I did 19 + not want to risk tanking that SEO when I moved domain names, so I have been 20 + putting this off for the better part of a year. As for why now? I got tired of 21 + internets complaning that the URL was "christine dot website" when I wanted to 22 + be called "Xe". Now you have no excuse. 23 + 24 + So the first step was to be sure that everything got forwarded over to the new 25 + domain. After buying the domain name and setting everything up in Cloudflare 26 + (including moving my paid plan over), I pointed the new domain at my server and 27 + then set up a new NixOS configuration block to have that domain name point to my 28 + site binary: 29 + 30 + ```nix 31 + services.nginx.virtualHosts."xeiaso.net" = { 32 + locations."/" = { 33 + proxyPass = "http://unix:${toString cfg.sockPath}"; 34 + proxyWebsockets = true; 35 + }; 36 + forceSSL = cfg.useACME; 37 + useACMEHost = "xeiaso.net"; 38 + extraConfig = '' 39 + access_log /var/log/nginx/xesite.access.log; 40 + ''; 41 + }; 42 + ``` 43 + 44 + After that was working, I then got a list of all the things that probably 45 + shouldn't be redirected from. In most cases, most HTTP clients should do the 46 + right thing when getting a permanent redirect to a new URL. However, we live in 47 + a fallen world where we cannot expect clients to do the right thing. Especially 48 + RSS feed readers. 49 + 50 + So I made a list of all the things that I was afraid to make permanent redirects 51 + for and here it is: 52 + 53 + * `/jsonfeed` - a JSONFeed package for Go 54 + ([docs](https://pkg.go.dev/christine.website/jsonfeed)), I didn't want to 55 + break builds by issuing a permanent redirect that would not match the 56 + [go.mod](https://tulpa.dev/Xe/jsonfeed/src/branch/master/go.mod) file. 57 + * `/.within/health` - the healthcheck route used by monitoring. I didn't want to 58 + find out if NodePing blew up on a 301. 59 + * `/.within/website.within.xesite/new_post` - the URL used by the [Android 60 + app](https://play.google.com/store/apps/details?id=website.christine.xesite) 61 + widget to let you know when a new post is published. I didn't want to find out 62 + if Android's HTTP library handles redirects properly or not. 63 + * `/blog.rss` - RSS feed readers are badly implemented. I didn't want to find 64 + out if it would break people's feeds entirely. I actually care about people 65 + that read this blog over RSS and I'm sad that poorly written feed readers 66 + punish this server so much. 67 + * `/blog.atom` - See above. 68 + * `/blog.json` - See above. 69 + 70 + Now that I have the list of URLs to not forward, I can finally write the small 71 + bit of Nginx config that will set up permanent forwards (HTTP status code 301) 72 + for every link pointing to the old domain. It will look something like this: 73 + 74 + ```nginx 75 + location / { 76 + return 301 https://xeiaso.net$request_uri; 77 + } 78 + ``` 79 + 80 + <xeblog-conv name="Mara" mood="hacker">Note that it's using `$request_uri` and 81 + not just `$uri`. If you use `$uri` you run the risk of [CRLF 82 + injection](https://reversebrain.github.io/2021/03/29/The-story-of-Nginx-and-uri-variable/), 83 + which will allow any random attacker to inject HTTP headers into incoming 84 + requests. This is not a good thing to have happen, to say the 85 + least.</xeblog-conv> 86 + 87 + So I wrote a little bit of NixOS config that automatically bridges the gap: 88 + 89 + ```nix 90 + services.nginx.virtualHosts."christine.website" = let proxyOld = { 91 + proxyPass = "http://unix:${toString cfg.sockPath}"; 92 + proxyWebsockets = true; 93 + }; in { 94 + locations."/jsonfeed" = proxyOld; 95 + locations."/.within/health" = proxyOld; 96 + locations."/.within/website.within.xesite/new_post" = proxyOld; 97 + locations."/blog.rss" = proxyOld; 98 + locations."/blog.atom" = proxyOld; 99 + locations."/blog.json" = proxyOld; 100 + locations."/".extraConfig = '' 101 + return 301 https://xeiaso.net$request_uri; 102 + ''; 103 + forceSSL = cfg.useACME; 104 + useACMEHost = "christine.website"; 105 + extraConfig = '' 106 + access_log /var/log/nginx/xesite_old.access.log; 107 + ''; 108 + }; 109 + ``` 110 + 111 + This will point all the scary paths to the site itself and have 112 + `https://christine.website/whatever` get forwarded to 113 + `https://xeiaso.net/whatever`, this makes sure that every single link that 114 + anyone has ever posted will get properly forwarded. This makes link rot 115 + literally impossible, and helps ensure that I keep my hard-earned SEO. 116 + 117 + I also renamed my email address to `me@xeiaso.net`. Please update your address 118 + books and spam filters accordingly. Also update my name to `Xe Iaso` if you 119 + haven't already. 120 + 121 + I've got some projects in the back burner that will make this blog even better! 122 + Stay tuned and stay frosty. 123 + 124 + What was formerly known as the "christine dot website cinematic universe" is now 125 + known as the "xeiaso dot net cinematic universe".