Transparent proxy issues. Resolver no attribute 'wfile'

For some reason when launching and then putting mitmweb into transparent mode, I receive a 502 bad gateway on my clients and the following error in the terminal:

192.168.178.40:41150: clientconnect
192.168.178.40:41150: Transparent mode failure: AttributeError("'Resolver' object has no attribute 'wfile'",)
192.168.178.40:41150: clientdisconnect

The reason I have to launch mitmweb in regular mode, and then switch it to transparent mode, is because mitmweb --mode transparent throws the error:

C:\Users\Admin>mitmweb --mode transparent
Error starting proxy server: PermissionError(13, 'Access is denied.', None, 5)

In order to fix this, I need to navigate to the config.yaml in C:\Users\Admin\.mitmproxy and set the mode back to regular manually.

Somewhere it seems that transparent mode is failing to initiate correctly.

Can anyone take a look with me?

You currently cannot change the proxy mode during execution - this is what gives you the first weird error. Transparent mode on Windows requires admin privileges, so the second invocation should work if you run it as Administrator.

1 Like