Closed artemkloko closed 7 years ago
But if you try to open http://static.local/, the request sent from mitmproxy arrives to nginx proxy as http://127.0.0.1:1080/ which the nginx proxy can not forward correctly due to missing host name.
We auto-update the host header based on the destination passed in -R
: http://docs.mitmproxy.org/en/stable/features/reverseproxy.html#host-header. You have to enable the keep_host_header
option, which we added recently. I think it made it into 2., but we haven't documented it yet. If you find that it works for you, I'd appreciate a PR that adds a short sentence to the part of the docs I linked to. :)
Hello, I am trying to implement the following setup, but I am not sure if this is possible with docker. And if it possible in what mode should I start the mitmproxy?
So in my host machine I add the following line to hosts file
I start mitmproxy dockerized with
-p 80:8080 -R http://127.0.0.1:1080
I start an nginx proxy dockerized with-p 1080:80
that forwards the requests depending on their host nameIf you try to open
http://static.local:1080/
the request goes directly to the nginx proxy and is forwarded further on correctly.But if you try to open
http://static.local/
, the request sent from mitmproxy arrives to nginx proxy ashttp://127.0.0.1:1080/
which the nginx proxy can not forward correctly due to missing host name.If I run mitmproxy in transparent mode (even with
cap_add: - NET_ADMIN
) it is getting into an infinite loop. If I run mitmproxy in regular mode or in upstream mode (-U http://127.0.0.1:1080
) and I getAlso all of the above setups, with the use of FoxyProxy plugin instead of hosts file - work.
I can also provide a
docker-compose.yml