Date Published: December 21, 2022
Pinning to a web server without using the hosts file
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.
In the JavaScript console, in either Firefox or Chrome, simply run the following command (be sure to set the right web node name):
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.
Using an /etc/hosts file for custom domains during development
Did not find what you were looking for?
If this content did not answer your questions, try searching or contacting our support team for further assistance.