I have an Android app, which is making request to example.com. How can I setup mitmproxy such that all requests to example.com/etc/else will go to dev.example.com/etc/else?
I tried this:
My script (rewrite.py):
import mitmproxy
from mitmproxy.models import HTTPResponse
from netlib.http import Headers
def request(context, flow):
if 'example.com' in flow.request.url :
flow.request.host = 'dev.example.com'
Also, for some reason I don't see logging output, for example:
from mitmproxy import ctx
...
ctx.log.info("This is some informative text.")
I'm running mitmproxy like this:
mitmproxy -p 8765 -e -s rewrite.py