question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

issue with transparent proxying: Invalid HTTP request form (expected: absolute, got: relative)

See original GitHub issue

Hi,

I am trying to setup mitmproxy as a transparent proxy.

I have a VPN network with internal IP 10.0.0.1/24. The proxy box is on 10.0.0.100. I want to transparently redirect client HTTP traffic on the VPN through the proxy. Each client should have its own proxy. Example:

sudo iptables -t nat -A PREROUTING -i ppp4 -p tcp --dport 80 -j DNAT --to-destination 10.0.0.100:6262
sudo iptables -t nat -A PREROUTING -i ppp4 -p tcp --dport 443 -j DNAT --to-destination 10.0.0.100:6262

This successfully redirects client traffic on ppp4 to the proxy. However, mitmproxy logs show:

10.0.0.108:60222: HttpError('Invalid HTTP request form (expected: absolute, got: relative)',)

I also see:

11.0.0.108:60225: HttpError("Bad HTTP request line:                                                                                
'\\x16\\x03\\x00\\x003\\x01\\x00\\x00/\\x03\\x00U\\xef\\x02+\\xb0^RE\\xa8\\xf0{\\xf3m\\xd8-\\x18\\xbaV\\x8a\\xa2\\xa0\\n'",)

I am starting mitmproxy with the command:

mitmproxy -p 6262 --host

The client has the mitmproxy root CA installed.

Am I trying to do something impossible? Am I missing a critical step?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
milesrichardsoncommented, Sep 8, 2015

Thanks, that seems to help. However, now I’m seeing hundreds of requests per second to the website address I try to access on the client device. All requests return 502 with an HTML error in the response body 'ProxyError(NetLibError('Error connecting to "10.0.0.100": [Errno 24] Too many open files',),)'. I do not see this error in the console.

The device an iPhone. I suspect this has to do with apple captive portal detection?

1reaction
mhilscommented, Sep 8, 2015

Thanks for the detailed report. Looks like you actually need to instruct mitmproxy to run in transparent mode: mitmproxy -T.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid HTTP request form (expected: authority or absolute, got ...
You run mitmproxy in regular proxy mode and then send a request to it. Where is mitmproxy supposed to send this request to?...
Read more >
Invalid HTTP request form (expected: authority or absolute, got
Hello - I'm trying to set up mitmdump as a reverse proxy, proxying into a set of servers via their private IP addresses...
Read more >
Request is not going through mitm proxy when I am trying to ...
Invalid HTTP request form (expected: authority or absolute, got: relative) xxx.xx.xx.xxx:xxxxx: HTTP protocol error in client request: ...
Read more >
Invalid HTTP request form (expected: authority or absolute, got
Steps to reproduce the problem: I used mitmproxy as forwarding proxy from Burp but I keep getting these error. Without mitmproxy
Read more >
Hypertext Transfer Protocol -- HTTP/1.0 - W3C
A proxy is a forwarding agent, receiving requests for a URI in its absolute form, rewriting all or parts of the message, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found