1

I my deployment enviroment I use local Hosts file to change domains destination to another server I use for development. It works nice and it's easy to setup. But as always there is a catch. If our client wants to see the dev site before its deployment to main server, we can't force him to set his hosts file, so he can't reach the site.

I was thinking that there must be some online tool that redirects any requests sent to it to server by your definition. So I would just send link to my client and he wouldn't notice anything, just like web proxy. I was googling for this but didn't find anything usefull.

Does anybody of you know any tool for this? (I don't care if its free or paid solution. I would probably write it on my own, I just don't want to reinvent the wheel.)

If it doesn't exist, what deployment solution/prodecure would you recommend?

Thanks for all responses

Marakoss
  • 113
  • 3
  • Can you please give more details about the current setup? – Mircea Vutcovici Aug 15 '12 at 18:07
  • Thats for a long story. Thank you for your exhausting answer, you've given enought possible solutions to this. I'll will accept it, because nobody else seems to know the tool for this. – Marakoss Aug 16 '12 at 07:17

3 Answers3

2

You should use a DNS server and have different domains for the development site and production one. E.g. dev.example.com vs. www.example.com

Your site should not be dependent on the DNS name, because site names can change. Imagine that you have www.example.com and your company is purchased by example2 and you have not only to change the hostnames and certificate to www.example2.com but also your code.

Another way to do it is to expose the dev site as www.example.com/dev To do this you can use a reverse proxy that redirects /dev to the internal dev site. If you give details about your architecture it is much easier for our comunity to give a better solution.

It is also possible to show different sites (prod vs dev) depending on other factors like source IP, authentication, a HTTP cookie...

You can also keep the public server on port 80/TCP and the dev on a different port, like 8080/TCP. Or you can have the HTTPS site the dev one.

Mircea Vutcovici
  • 17,619
  • 4
  • 56
  • 83
  • almost same answer at the same time ;) –  Aug 15 '12 at 15:24
  • We actually can serve for each subdomain another site. But only if DNS server is in your competition and if we have access to server files. Imagine situation where client have already some website made by another company. I'm looking for time-saving solution, because this happens a lot. Also we have zero-fail tolerance and hosts allows you to test your website as it'll be on production sever. – Marakoss Aug 15 '12 at 15:29
  • The simplest one would be a reverse proxy like: dev-example1.mycompanyproxy.com for example1 company dev site and dev-example2.mycompanyproxy.com for the example2 company dev site. – Mircea Vutcovici Aug 15 '12 at 18:09
  • Something like reverse proxy would work, but not fully. The links within the site (lets say example.ourhost.com) would still aim to example.com ... So once the client click on that link, it would redirect him to production version so it wouldn't work. – Marakoss Aug 16 '12 at 07:20
  • Thats why I was looking for some tool that has this things fixed (every online web proxy can do this) – Marakoss Aug 16 '12 at 07:22
  • It is possible to fix the redirections and the links with an apache reverse proxy. For redirections use: `mod_proxy` and the option `ProxyPassReverse` and for links in HTML: `mod_proxy_html` and the option `ProxyHTMLURLMap` – Mircea Vutcovici Aug 16 '12 at 18:13
1

DNS is the simplest solution if your client doesn't want to modify /etc/hosts.

Just make www-dev.example.com point at the dev website. Don't forget to allow only your client to access www-dev.example.com (password, firewall, acl ...).

That won't work if the website needs visitors to type www.example.com, but what you describe in your question won't work too in such a situation.

I haven't heard of any online tool that can do what your describe, but all the proxy servers I know (varnish, apache and even squid) know how to forward any http request to the same backend.

0

Keep it simple. I'd either use a reverse proxy as suggested by Mircea or just host the site in a temporary location (subdomain, domain, or folder).

ceskib
  • 761
  • 1
  • 9
  • 24