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.

Cannot modify HTTP/2 responses

See original GitHub issue
Steps to reproduce the problem:

Perhaps I’m missing something here, but I cannot seem to modify HTTP/2 responses. HTTP/1.1 works fine. The following script breaks when the browser attempts to use HTTP/2:

def response(flow):
	flow.response.headers['X-Filtered'] = 'true'

Invoked with mitmproxy -T --host -s script.py.

Any other comments? What have you tried so far?

If I additionally add --no-http2, the script works correctly. If the browser does not use HTTP/2, everything also works as expected.

System information
Mitmproxy version: 2.0.1 (release version) Precompiled Binary
Python version: 3.5.2
Platform: Linux-3.16.0-4-amd64-x86_64-with-debian-8.7
SSL version: OpenSSL 1.1.0e  16 Feb 2017
Linux distro: debian 8.7 

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mhilscommented, Apr 25, 2017

Can you be more specific regarding “breaks”? Does it work if you specify the header name as lowercase?

0reactions
Kriechicommented, Apr 26, 2017

This should be fixed already in git-master: https://github.com/mitmproxy/mitmproxy/pull/2055/files

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to make http2 requests to an Apache Server, though ...
In the address bar of Firefox, type "about:config", then search for "network.http.spdy.enabled.http2" and make sure that it is set to true.
Read more >
HTTP response status codes - MDN Web Docs - Mozilla
HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes:
Read more >
HTTP/2 Frequently Asked Questions
Servers that don't wish to process the HTTP/1.1 response should reject stream 1 with a REFUSED_STREAM error code immediately after sending the connection ......
Read more >
Introduction to HTTP/2 - web.dev
HTTP/2 does not modify the application semantics of HTTP in any way. All the core concepts, such as HTTP methods, status codes, URIs,...
Read more >
Updating HTTP responses in origin response triggers
Use Lambda@Edge to modify HTTP responses from the origin before forwarding them on to viewers.
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