For learning and testing purposes I'd like to change the UserAgent in the HTTP header.

In the desktop Firefox it is simple: there is an add-on for this task. But on android... it is impossible. I thought, I will setup a proxy (privoxy for example) and it will change that header.

Yes, I know, most of the servers are using SSL/TLS, and modification of that communication is nearly impossible, but... I have seen the traffic between my client and server (with Wireshark) and... the CONNECT is in plain text, an it contains the UserAgent. The privoxy can change it, while I use HTTP, but can't when my server uses HTTPS...

Have you got any idea, why and how can I ask it, to do that change?

  • 4
    While there exist many tools that are capable of intercepting and modifying TLS traffic from a consenting device (one that trusts the proxy's own root CA cert), I also just find your question baffling. There are multiple browser apps - including for free - on the Play store that support custom user agents. What is your actual end goal here?
    – CBHacking
    Oct 26, 2021 at 3:43
  • You misunderstand me. You're talking about a MitM attack. I don't want to do it (but I can - theoretically at least ;) ). I just read about user tracking technics, and I found it an interesting thing. Mostly to protect myself from these little-known technologies. What do you think, how many users know (or at least heard about them) what is browser fingerprinting, ever-cookie etc? I'm trying to protect myself, as I can, and trying to learn more. And I'd like to protect my all clients, not just a browser - if it is possible. Oct 26, 2021 at 7:33
  • Only the essence left out from the comment above: I don't want to modify the encrypted communication. I want to modify only the unencrypted parts in the CONNECT packet. Oct 26, 2021 at 7:45
  • Only modifying the unencrypted part is rather useless: the real site receiving the HTTP request will probably not see the CONNECT packet because most professional site handle the SSL/TLS part on a proxy and not on the the main application server. Oct 26, 2021 at 8:21

1 Answer 1


mitmproxy can handle this. Once running on a machine in your network, you'll need to install the mitmproxy SSL certificate authority on whatever client you want to intercept requests from. After that, just configure the device to use an HTTP proxy and point it at your proxy.

mitmproxy offers an API that allows you to write Python code to modify requests on-the-fly. This example shows how you can modify request headers - changing the User Agent header should be trivial.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .