I have a mitmproxy instance running on port 2222. I want to put it behind a reverse proxy (like Nginx or Caddy), so I can use it as mitmproxy.tld. It seems that mitmproxy can't be accessed by anything other than 127.0.0.1 or localhost, though I'm not sure about this.
curl -x http://mitmproxy.tld:80 google.com -v gives me a 500 Internal Server Error
I have something that sort of works ---
stream {
map $ssl_preread_server_name $port {
hostnames;
proxy.history.* 2222;
default '';
}
server {
listen 127.0.0.1:1080;
ssl_preread on;
proxy_pass 127.0.0.1:2222;
}
The problem is that there's no variable for the proxy host name, so I can't check if people are accessing the proxy from the right domain.