A common way to test an existing website on a new server before switching it to production by updating the DNS record is to change the
hosts file on a development machine (
/etc/hosts on *NIX systems, and
%windir%\system32\drivers\etc\hosts on Windows), to have the OS resolve the hostname of the server to the new server. The developer can thus test the new server in real conditions before the actual deployment.
Now, changing the
hosts file also has some downsides, among which:
Hence the question: is there a way to do this change only within the browser (for Firefox, Chrome, and/or MSIE)? Looking for Firefox, I've found two or three add-ons, but they all do the same: modifying the OS-wide
I'm looking for a self-contained lightweight solution working on both MS Windows and Linux, that does not require administrator privileges (so I can for example have students do that on their lab PCs), and without any external hardware/services (e.g. a router doing DNS spoofing or a proxy server doing the same).
In Chromium, you can use the
--host-resolver-rules option to specify a list of mappings.
$ chromium \ --user-data-dir=/tmp/some-temp-dir \ --host-resolver-rules='MAP host1.example.com 127.0.0.1, MAP host2.example.com 127.0.0.1'