Skip to main content

Use mitmproxy to Unminify Your Requests

Sometimes, when hunting bugs in production, I don't want all of the minified resources. All my CSS and JS is minified and, while efficent, isn't very friendly for debugging.

Enter mitmproxy

In my words: mitmproxy is a fast little proxy that runs on the command line and can be extremely powerful.

In their own words:

mitmproxy is an interactive, SSL-capable man-in-the-middle proxy for HTTP with a console interface.

I have an alias for the following command:

mitmproxy --replace ":~q ~u \\.min\\.(js|css):\\.min:"

In short, it tells mitmproxy to start up and find all incoming requests (~q) that match the regex \.min\.(js|css) in the URL (~u). Then in those reqeusts that finds it will replace \.min with 'nothing'.

The semi-cryptic documentation on 'replace' can be found in their documentation.

mitmproxy can be used for much more than this is only a simple example. Check it out!