Working with development servers

I can’t believe that this is not a solved problem by now, but my Google-fu is failing me. I’m looking for a decent, working extension for Chrome that can redirect a list of hosts to a different server while setting the Host: header to the right address. Everything I’ve found so far assumes that you’re running the servers on different urls. I’m using the same URL on different servers and don’t want to mess around with /etc/hosts.

Please tell me something exists to do this?

5 thoughts on “Working with development servers

    • David Pashley
      on said:

      I’m currently considering setting up a solution involving using Apache on localhost as a forward proxy to itself. Then I can use a proxy switcher to do what I want. This approach seems to agree with your answer.

      That extension only appears to modify the DOM to change links to point to the new server. The HTML will still come from the original server. I did find an extension that allowed you to modify your /etc/hosts in the browser, but you had to make the file world writeable. Unbelievable.

      I suspect the reason why this isn’t possible in an extension is before it would be a bad idea to allow extensions to modify DNS responses.

      Thanks for your help though.

      • Kevin Brandstatter
        on said:

        The problem generally is that you need to either override the dns lookup with the /etc/hosts, or to somehow trick the browser into thinking it lookied it up by seeding the cache. Nothing I searched for indicates that javascript/chrome extensions could modify the DNS cache of the browser (where youd just “cache” the ip you want and the browser would use that one) which makes sense as there are obvious malicious uses for that. Other than that, the standard way of balancing the same site on more than one server is some proxy like you are already doing. Of course if its development vs production server I don’t see a downside to a subdomain.

        • David Pashley
          on said:

          The main reason for wanting to avoid changing the domain name between development and live is that the database contains references to the domains being served. As I plan on doing regular refreshes of development from live, updating these references could be a pain. I think I’ve found a working solution of using a proxy switcher (in this case SwitchySharp) to use the development webserver as a proxy server when I want to use the dev instance. This pretty much just works, although it wouldn’t surprise me if there were subtle corner cases I haven’t considered.

  1. I usually use iptables DNAT rules to redirect the output to the desired IP address. That takes effect quickly and easily (no reloading proxies) and is transparent to the client.

    One thing I haven’t tested (but which should work) is to use iptables rules based on UID so that I can have two browsers running as different users that see different versions of the web site.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.