Search This Blog

Thursday, January 31, 2013

How to modify HTTP Host header in Chrome

HTTP protocol troubleshooting requires sending of GET requests with a preset headers like 'Host' one. You can always do it using curl but you may want to see the result directly in your browser.
$ curl -H "Host: rado.example.com" http://www.google.com/mysite_rado.html

Problem

How to set and change the default Host header when Chrome sent request.

Solution and demonstration

We can use the 'Change HTTP Request Header' extension. It allows us to tamper the default browser headers. The best part is that it works well with HTTP as well as HTTPS base requests.

This is how the extension looks like.

This is how we have to configure it to change the Host header to different value like 'rado.example.com'.
And this is how an original and modified request looks like on Developer tools.

References
  1. https://chrome.google.com/webstore/detail/change-http-request-heade/ppmibgfeefcglejjlpeihfdimbkfbbnm

How to inspect HTTP headers for GET request in Chrome


When troubleshooting HTTP protocol it is required to inspection and verify various HTTP headers for the sending requests and receiving response.


Problem

When in Chrome navigating to http://example.com/mysite.html URL how to see all headers.

Solution and demonstration

There are very few extensions that allow you to inspect the request headers  Most of them give you access to the response data only. The Developer tools is the only one extension I found that shows request and response headers in Chrome.

This is how you can start and test it:

References
  1. https://developers.google.com/chrome-developer-tools/
  2. http://stackoverflow.com/questions/4423061/view-http-headers-in-google-chrome 
  3. http://blog.ashfame.com/2010/05/view-html-headers-firefox-google-chrome/