Invalid HTTP request form (expected: authority or absolute, got: relative)


#1

Hello -
I’m trying to set up mitmdump as a reverse proxy, proxying into a set of servers via their private IP addresses (in an AWS VPC). I think my problem is in the startup params, as no matter what I try, I’m getting this error:
Invalid HTTP request form (expected: authority or absolute, got: relative)

My run command is this (using 8079 as a “dummy” server):

mitmdump --set onboarding=false -p 8079 &
mitmdump --mode upstream:http://localhost:8079 --set block_global=false -s rproxy.py

And rproxy.py is:

from mitmproxy import http, ctx
from mitmproxy.script import concurrent

class Forward:
    
    @concurrent
    def request(self, flow):
       ip='172.31.17.123'
       if flow.live:
           print("Changing upstream to " + ip)
           flow.live.change_upstream_proxy_server((ip,8080))

addons = [
    Forward()
]

#2

If you want to run a reverse proxy, you should specify reverse proxy mode, not upstream proxy mode: https://docs.mitmproxy.org/stable/concepts-modes/