0

We don't have our internal web servers, everything is hosted, but we do want to have the ability to use short, private domain names. For example, I want to be able to type in our browser "http://wiki" and it will be redirected to a web page on public URL "https://mycompany.atlassian.net/wiki".

I can do the DNS redirect trick in my own machine using the hosts file. Is there a better way without having to ask everybody in the team to manually change their hosts file? We don't have any private web servers inside the office. Everything is in the cloud.

5

How to do DNS redirect without DNS server?

(I'm assuming you mean CNAMEs, because DNS doesn't redirect) By definition, you can't. Unless you use hosts file hackery. Also note that while you can CNAME a hostname wiki to mycompany.atlassian.net you cannot use DNS to "redirect" wiki to mycompany.atlassian.net/wiki. What's the problem? The /wiki at the end. That's more than just a hostname, that's a directory served over HTTP. DNS has no concept of that. DNS only knows hostnames and domains. If you want wiki to be forwarded to mycompany.atlassian.net/wiki you need HTTP redirection.

Is there a better way without having to ask everybody in the team to manually change their hosts file?

You use a DNS server if CNAMEing or you use a HTTP server if you want full URL redirection to a directory. You're attempting to do mutually exclusive things and will continue to be frustrated and thwarted.

but we do want to have the ability to use short, private domain names.

You want something that takes work, but don't want to do the work. This will not end well. But hark! I have the solution...

The best solution:

Stop trying to shortcut DNS and instead use the right tool that perfectly intersects the Venn diagram that appears to exist amongst your team1: Browser bookmarks.

Whitespace to add maximum effect! Dangit markdown, let me have vast whitespace without br wonkery!

1 That Venn diagram would be: Too lazy to type long URLs and simultaneously unwilling to do the work necessary to make short URLs work.

| improve this answer | |
2

What you want is not just DNS, but an HTTP redirect. http://wiki needs to get directed to a server which recognises it and serves a 301 or 302 redirect to an appropriate address.

So to make this work for your local network, you need a suitably configured web server which serves the HTTP redirects, and you need a local dns server which gets the requests to that web server.

It's likely that you have a local web and/or dns server on your network already, in which case the configuration will need to be appropriate for whatever sort of servers you are using.

That said, suppose you had a linux box on 192.168.1.2, running dnsmasq and nginx, and then the following would work. This is off the cuff, not a tested config. It shouldn't be far off, but I might have made a mistake.

in /etc/hosts:

wiki  192.168.1.2

in /etc/nginx/sites-available:

server {
  listen 80;
  server_name wiki;
  rewrite ^ $scheme://mycompany.atlassian.net/wiki permanent;
}

And you need a symlink:

ln -s /etc/nginx/sites-available /etc/nginx/sites-enabled

reload your nginx config:

service nginx reload

Make sure your dhcp on your router points users to the 192.168.1.2 as the name server, and you should be right to go.

| improve this answer | |
0

The other answer is accurate in my opinion but in the spirit of answering your question the hosts file is the only choice I can think of.

If you are running Windows and on a Windows domain you can use group policy to push hosts files to your desktops and only have to maintain one file.

If you are on multiple platforms you can still do the same using a network share and scripts that could be manually run to pull updates to hosts files.

You might also be able to run a proxy server with specific rules in it to forward requests that match http://wiki to a specific FQDN but then you need to get everyone to configure proxy settings, run a proxy server, etc.

Is all of this work really worth not telling people to use bookmarks or type in a fully qualified URL?

| improve this answer | |
  • Host file isn't even going to be enough. OP wants wiki to go to mycompany.atlassian.net/wiki". Which involves https redirection and adding /wiki to the end of the url. You can't do this at the DNS level. – Nath Dec 20 '15 at 5:11
  • You are correct. I missed the 's' in the OPs example and assumed it was all HTTP. User education is probably the correct answer for this question. – FiZi Dec 20 '15 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.