Hacker News new | ask | show | jobs
by johnasmith 1374 days ago
I wrote myself a Chrome extension that does this, using http://l/foo style links, and using Chrome's sync to share across devices. Works well enough but limited to desktops.

Some large orgs maintain internal shorteners, like http://go links at Google.

3 comments

I recall seeing go link stickers around Google's Mountain View campus in the early 2010s! That was the first time I had seen something done like that, "overriding" an entire TLD zone (not that `.go` is in use, anyway) to serve custom content.

Do you happen to know how Google, or any other places, do this? I assume a custom DNS resolver being forced on clients through a network could do this, or maybe hosts files for each machine.

It's important to note that http://go/ and http://go./ are different things. The former means "consult my search path", the latter means "lookup the apex record of the go TLD". When you write "example.com", you really mean "example.com.", for example. Someone decided that browsers should save you a byte, and now every URL is ambiguous, causing all sorts of problems. (For example, if your search path is "corp.company.com" and you type "example.com" into your URL bar, you should be taken to "example.com.corp.company.com" before trying "example.com", but that turns out not to be what anyone wants, so you're pretty much screwed if you DO want that behavior. As always, the core of the Internet is duct tape and chewing gum.)

This often bites people when they wonder why they blow up their DNS servers with traffic from services that contact addresses like "foo.default". With a search path of "search default.svc.cluster.local svc.cluster.local cluster.local" in resolv.conf, the app is actually looking up foo.default, foo.default.default.svc.cluster.local, foo.default.cluster.local, and foo.default.svc.cluster.local, etc. every single time. Hard-code "foo.default.svc.cluster.local." in the app config, and you eliminate requests for the names that can't possibly exist, and save the load (and latency) of handling them.

You don't need to override a top-level domain. If you have the company DNS specify a search domain of the company owned website, you can just have the "go.<company-website>" available on the internal DNS. whenever someone enters go/whatever into a webbrowser, it will then resolve "go" into that internal "go.<whatever>" server.
Using DHCP to send a DNS search path can make this work across a lan, which is how it works in most work environments.

If you set your dns search path to example.com then http://go would resolve to go.example.com which could be your link shortner.

What's the name of your extension? I've been using https://www.trot.to/go-links for this and it's nice to know I could scale it out to my company if I wanted, but I'd prefer something that didn't depend on a service for my personal usage.