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

1 comment:

  1. You can also use Requestly - Chrome Extension to modify request and response headers. Requestly has a simple and beautiful UI to modify network requests. Checkout this:

    1. http://stackoverflow.com/questions/3274144/can-i-modify-outgoing-request-headers-with-a-chrome-extension
    2. https://chrome.google.com/webstore/detail/requestly/mdnleldcmiljblolnjhpnblkcekpdkpa?hl=en

    Disclaimer: I am Requestly Developer.

    ReplyDelete