kellegous / go

Another Google-like Go short link service
MIT License
584 stars 122 forks source link

How to configure #3

Closed 8enmann closed 7 years ago

8enmann commented 7 years ago

You wrote in the README: Make sure that corp.mycompany.com is in the search domains for each user on the network. This is usually easily accomplished by configuring your DHCP server.

How do I do that? I'm using Amazon Route53 and have it serving on the long domain (go.corp.example.com) but how do I allow users to just type go in their browser?

kellegous commented 7 years ago

Good question. I should put this in the README.

First, I use Google Cloud DNS for my DNS server but the same applies to Route53. Let's say that I have a go service running on 104.104.100.100 and I create a DNS entry, an A record for go.home.kellegous.com and it resolves to that IP address (104.104.100.100). I can now reach the server with the fully qualified name go.home.kellegous.com.

The next step is to make it so that I can simply enter go into the browser and have it go to the right place. To do that I have to configure the laptop that I am using to use a search domain of home.kellegous.com. That just means that when I type in go it will also try go.home.kellegous.com. I can do this on my laptop, by adding a search domain in the Network Settings. On macOS, it looks like this.

screen shot 2017-04-04 at 21 11 02

This works just fine if you are just wanting to make this work on a single laptop. I want it to work for all computers on my local network. So I configure my DHCP server to instruct all computers that ask for an IP Address to also use the search domain of home.kellegous.com. For an AirPort Extreme, the setup looks like this.

screen shot 2017-04-04 at 21 03 22

Now when a new user joins my network, their computer should automatically told about the search domain. Not all platforms support the search domain. I find that most phones do not, but it works reasonably well for laptops and desktops.

8enmann commented 7 years ago

Awesome! We have a provisioning script and I found out that there's a commandline equivalent for mac: networksetup -setsearchdomains Wi-Fi corp.example.com Thank you!

8enmann commented 7 years ago

Found another way:

killall Google\ Chrome
sqlite3 ~/Library/Application\ Support/Google/Chrome/Default/Web\ Data "insert into keywords (id, short_name, keyword, favicon_url, url, date_created) values (999,'go', 'go', '', 'http://go.corp.example.com/{searchTerms}', 1491349247);"