Hello,
We are trying to analyze traffic between our Nginx reverse proxy and Web server:
Client --> Internet --> Nginx --> Webserver
Client --> Internet --> Nginx --> mitmproxy --> Webserver
If I understand correctly we should use a reverse mode:
mitmproxy --listen-port 8080 --mode reverse:http://webserver:8081
But our clients send requests with one URI which is routed by Nginx to Webserver to another URI:
client --> nginx/api/input --> webserver/api/output
Probably we may achieve this by using a script. We tried this one:
def request(context, flow): if flow.request.path == '/api/input': flow.request.path = '/api/output'
mitmproxy --listen-port 8080 --mode reverse:http://webserver:8081 --script rewrite_path.py
But it doesn’t do the work, we still see:
POST http://webserver:8081/api/input
- How proxy URI can be specified in mitmproxy?
- If with the script only where we may find a sample?
- How mitmproxy may be started in reverse mode with the script, should we specify a mode in such case?
Thank you!