How to install go/links
Published 2018-04-19
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:
- In Chrome, you’ll have to type in the protocol the first time
http://go/coffee
. After that, you can just typego/coffee
or any other keyword. - In Firefox, typing
go/coffee
will work, this results in the browser first searching forhttp://go/coffee
. If that doesn’t exist, it falls back to a search engine. - Safari never really learns.
http://go/coffee
will work, and after thatgo/coffee
will work, but other keywords will still require thehttp
protocol. - In general, browsers tend to treat a
go/link
as a regular search engine query instead of a URL. As seen above, typing in the protocol as well usually bypasses this:http://go/coffee
.
Happy go linking!