2

I want to modify browser request headers to include custom headers with each of my requests. This can be done by using special browser extensions. But, can it be done without using any browser extensions ? Ideally, the approach should be browser agnostic & OS agnostic.

2

Use an HTTP proxy.

HTTP proxies can rewrite intercepted requests by adding, removing and modifying headers. Any Web browser can be configured to use any HTTP proxy.

Popular implementations:

  • BrowserMob Proxy. Is a free programmable Java proxy that can be integrated with Selenium/Web Driver (in embedded mode) but also can be used as a standalone proxy for manual tests.
  • Charles Proxy. Is paid proxy with excellent GUI. It's main goal is sniffing and debugging HTTP traffic but it also has rewrite rules. Works on MacOS, Windows and Linux.

  • Fiddler is another paid proxy. I haven't used it for modifying requests, but I've read it supports that.

| improve this answer | |
  • Thanks, would you recommend fiddler and wireshark as well ? – JohnSink Sep 20 '17 at 17:47
  • Btw, one thing that concerns me about Charles is that there is just one developer working on it. It could be a big problem if he stops working on charles. Moreover, charles is not his full time job. So, I don't know what happens to bug reports, enhancement requests etc. filed by users. – JohnSink Sep 20 '17 at 17:54
  • 1
    @JohnSink. First, Charles Proxy requires paid license after 30 days, so I guess you pay for support. Also, a lot of open source test automation software I used is one man's job. REST-assured and Awaitility are done by a father of two kids, who maintains those libraries when he does not need to take care of his family :-) My experience is that usually main fatures work fine because a lot of users tested this in practice or even fixed that because they care. Less used features I found to be buggy. But updating headers doesn't seem to be very fancy and extreme case, so I wouldn't be afraid. – dzieciou Sep 24 '17 at 20:01
  • 1
    @JohnSink I included Fiddler in my response. Regarding Wireshark, I've seen it in action mostly when used for sniffing TCP/IP protocol traffic.I think it has possiblity to visualize higher level protocols like HTTP but in your use case it seems to me like using a cannon to kill a fly. Plus, I haven't seen if it support modifying requests. – dzieciou Sep 24 '17 at 20:14
  • @JohnSink. P.S. I have used Charles since 2012. – dzieciou Sep 24 '17 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.