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.

Mitmproxy received an absolute-form request error

See original GitHub issue
Steps to reproduce the problem:

tcpdump result:

CONNECT sample.domain.com:80 HTTP/1.1
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Host: sample.domain.com:80

HTTP/1.1 200 Connection established

POST http://sample.domain.com/ajax/info/info HTTP/1.1
User-Agent: Unity/5.4.3p4 (Mac OS X 10.12.3; MacBookPro12,1)
Host: sample.domain.com
Accept-Encoding: gzip, identity
Proxy-Connection: Keep-Alive
Connection: Keep-Alive, TE
TE: identity
Content-Length: 0
Cookie: apv=1.0; abc=; abd=; abe=

HTTP/1.1 400 Bad Request
Server: mitmproxy 2.0.0
Connection: close
Content-Length: 436
Content-Type: text/html

<html>
            <head>
                <title>400 Bad Request</title>
            </head>
            <body>
            <h1>400 Bad Request</h1>
            <p>HttpException(&#x27;Mitmproxy received an absolute-form request even though it is not running in regular mode. This usually indicates a misconfiguration, please see http://docs.mitmproxy.org/en/stable/modes.html for details.&#x27;,)</p>
            </body>
        </html>HTTP/1.1 502 Bad Gateway
Server: mitmproxy 2.0.0
Connection: close
Content-Length: 479
Content-Type: text/html

<html>
            <head>
                <title>502 Bad Gateway</title>
            </head>
            <body>
            <h1>502 Bad Gateway</h1>
            <p>ProtocolException(&#x27;HTTP protocol error in client request: Mitmproxy received an absolute-form request even though it is not running in regular mode. This usually indicates a misconfiguration, please see http://docs.mitmproxy.org/en/stable/modes.html for details.&#x27;,)</p>
            </body>
        </html>
Any other comments? What have you tried so far?

I fixed this temporarily with https://github.com/mitmproxy/mitmproxy/blob/83f1e2eec01ab3edec723b252b0c109f00b77c56/mitmproxy/proxy/root_context.py#L100

- return protocol.Http1Layer(top_layer, http.HTTPMode.transparent)
+ return protocol.Http1Layer(top_layer, http.HTTPMode.regular)
System information

Mitmproxy version: 2.0.0 (release version) Python version: 3.6.0 Platform: Darwin-16.4.0-x86_64-i386-64bit SSL version: OpenSSL 1.1.0e 16 Feb 2017 Mac version: 10.12.3 (‘’, ‘’, ‘’) x86_64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sk3lk0commented, Dec 18, 2019

–relax-http-form-validation not working

1reaction
Kriechicommented, Mar 1, 2017

Yes, this is what most clients do. They send a CONNECT with the host they need a connection to, and then they only send relative paths.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transparent mode misconfiguration - mitmproxy
All seems normal as no error messages were returned by Linux. ... error in client request: Mitmproxy received an absolute-form request
Read more >
Bad HTTP request line - Google Groups
Hi, I just upgraded to 0.9 (with the ubuntu packaged 0.8 I was running into 100% CPU consumption issues), but now mitmproxy seems...
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 >
test/mitmproxy/proxy/test_server.py - GitLab
Port error. 73. l.request.port = 1. 74. # In upstream mode, we get a 502 response from the upstream proxy server.
Read more >
http.py - searchcode
186 187 form_in: The request form which mitmproxy has received. ... authority-form only) 200 201 port: Destination port (absolute-form and authority-form ...
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