Redirect multiple domains to a single domain


#1

I looked around for several hours and couldn’t find a solution to my problem.

I want to redirect webmail.abc.com to abccom.xyz.com where webmail.abc.com resolves to my mitmproxy server and abccom.xyz.com resolves to a email client login page I created that replaces my hosting partners webmail page.

i.e. this is a server to server redirection one might use apache vhosts but I would like to use mitm instead.

Any help would be appreciated.


#2

I have tried so many different tests I didnt post any of them because I thought it would be more confusing. The most recent thing I tried is:
mitmproxy -R http://webmail.abc.com -p 80 --replace :~q:abc:xyz --replace :~q:webmail:abccom

There is never a response with the replacements so it times out.


#3

How should that redirection look like? Do you want to display the contents of abccom.xyz.com at webmail.abc.com? Do That could be tricky: http://docs.mitmproxy.org/en/stable/modes.html#reverse-proxy Do you want to send a HTTP 30x redirect? What exactly are you trying to accomplish?


#4

Thanks for the help.

I am essentially redirecting all port 80 requests for webmail to a custom login screen by domain.

I was able to get mitmproxy working after modifying the redirect_request.py and a lot of trial and error.

Do you have any startup script examples of running mitmdump for ubuntu 16.04?


#5

We don’t, but that’s a rather non-mitmproxy-specific problem, so you should find a lot of examples for writing systemd service files on Google/StackOverflow. :slight_smile: