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.

asked Sep 11, 2017 at 20:23

1 Answer 1

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.

answered Sep 12, 2017 at 4:38
5
  • Thanks, would you recommend fiddler and wireshark as well ? Commented Sep 20, 2017 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. Commented Sep 20, 2017 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. Commented Sep 24, 2017 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. Commented Sep 24, 2017 at 20:14
  • @JohnSink. P.S. I have used Charles since 2012. Commented Sep 24, 2017 at 20:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.