During website development, you may want to force your web browser to point to a specific host for testing. One way to do this is to Use an
/etc/hosts file for custom domains during development. If this isn't easy or feasible for you or your users, it may be possible to use a browser extension instead.
If you are using Google Chrome as a browser, the ModHeader extension enables you to add and modify the HTTP request headers sent to web servers.
If, for example, you need to access a specific server that is limited to particular regions, you can use this to modify the HTTP request headers you are sending. Once the extension is installed, you'll see a blue icon next to your address bar.
- If you click that icon, you should see a screen like this:
- Add the Header Host, with the respective domain.
- Activate that header by selecting the check box.
This configuration is set globally. While it's active, the extension will send that header to all sites you access with Chrome. Clear the header to disable it.
Define a cookie
Another method is to define a cookie which can be useful for tailing logs.
document.cookie = "ah_app_server=XXX-XXXX;path=/";
When you are done, you can unset the value in the cookie to stop your client being pinned to a specific server:
document.cookie = "ah_app_server=;path=/";
You can also just delete the cookie in your browser preferences.