This is an alternative to implementing your own back-end proxy API server, with say Express, right? So then what about in production using this method?
Yes and proxying with Express is a great approach — and much simpler for everyone who works on a project in the long run as it doesn’t require any special setup. A number of projects I work on use an Express proxy.
A reverse proxy in Express also works well in production as well.
I wouldn’t advocate using something like mitmproxy in production though, as it would complicate deployment and I’m not sure how reliable it would be if left running for a long period of time.
I think the best case for something like mitmproxy is if you want to quickly test against a remote service you don’t have control over and/or without writing any middleware yourself.
Personally most of the time I find it easier to just use Safari or Chrome with security disabled for that, but the latter especially doesn’t work in all cases so it’s sometimes handy to be able to transparently proxy while re-writing headers to test things or do exploratory work to check out an API (or if you are trying to check a fix for a big that only occurs in another browser like Firefox where you can’t disable the security options as easily).