I'm looking for a library that i can use to run a proxy server.

It should provide the ability to modify the request headers and body before dispatching to the target host and the response headers and body before dispatching to the client, the modification function should work even on https protocol(by decoding the connection and sending the modified response with a self generated certificate that the clients should trust in their browsers).

These functions are available in http debugging tools like Fiddler (with it's fiddlerscript scripting) but I'm looking for a python solution, also the library should be tailored to production proxy server and not testing and debugging purposes.

1 Answer 1


Assuming you can use Python >= 3.6, you might want to look at mitmproxy - see also the github page and an example for how to add headers.

You'll want to use the mitmdump component to do this. E.g:

mitmdump -s examples/add_header.py

Your Answer

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

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