Serving WSGI app without "Server" header


I am trying to get rid of “Server” header which is added by mitmproxy itself when serving WSGI application.

I am following example from examples/ Traffic from WSGI app looks like:

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 12
Server: mitmproxy 0.16
Date: Mon, 30 May 2016 05:54:37 GMT
Expires: 0
Cache-Control: no-cache

How can I disable “Server” header completely or send a fake server header instead?

“”“Server: mysterious_black_box ver.1234.5678"”" would be preferable…

Bad news and good news. First the bad - this is not currently configurable in mitmproxy. The NAMEVERSION value passed here is the culprit:

Now the good news - I’d be happy to pull a patch that implements this, and it should be very straight-forward - extend the AppRegistry…add method with an optional servername value, which is version.NAMEVERSION by default. That will give you the lever you need to set the server version to any value you like.