goat blog

How to install go/links

If you’re interested in setting up an internal URL shortener at your work place, aka go links, there are plenty of open source versions such as kellegous/go. It’s also a fun, easy hack week project to build from scratch, if you’re not afraid of a little NIH. Or you can try Goat, which provides go links as a service.

For the full experience of just typing go/keyword, you’ll also want to set up DNS search domains, also known as DNS suffixes. This is the real magic. For example, if you add goatcodes.com as a search domain, when you enter go/coffee in your browser it will search for go/coffee as well as go.goatcodes.com/coffee.

DNS search domains can be configured in two places: locally on your own computer (e.g on your Mac), or on your network. The latter is preferable in an office setting, because it makes the go links available automatically to everyone on the network. If you have multiple networks, such as a wifi network and a VPN, you may have to configure DNS search domains on all of them. The setting can usually be found under DHCP settings.

Next, you’ll need to make sure your URL shortener knows how to handle go/. Goat automatically takes care of this, but if you’re running your own service, you’ll need to configure your server. For example, if you’re using nginx as a proxy, you’ll want to add go to your nginx config, like this:

server {
    listen      80;
    server_name go;
    rewrite     ^ https://go.corp.example.com$request_uri?;
}

There are a couple of important gotchas. The first is that because it’s tied to DNS, it’s behavior can vary depending on where you’ve configured the search domain. Changing networks may alter the DNS search domains being used by your computer.

Secondly, this URL format is somewhat unusual because it lacks a TLD (e.g. .com), and thus browsers don’t quite handle it in quite the same way:

Happy go linking!

Share this post on Twitter