Server Replay Without Timing


#1

I’m trying to understand the server replay feature a little better. What I want to do is pretty straight-forward:

The first time a server makes a request to a url, serve the response and then cache it locally. Every subsequent request should be served immediately from cache.

I don’t want to “replay” the response exactly the same way it was originally served because it’s slow on the first request (i.e. it takes 15s to respond on the first time, I want it to basically be instantaneous after that).

Is this the right tool for the job? I know I could probably use Squid or some other proxy, but I want to use mitmproxy for other things (rewriting responses etc.) and so it would be great if I could use a single tool, and it seems possible. Maybe I need to write my own addon though?

Any help better understanding the server replay feature would be greatly appreciated!


#2

Just wanted to leave an update here, I used the replay feature, saved out the flow response to a file, then used

mitmweb --mode reverse:http://localhost:3000 -S saved_flow --server-replay-nopop

This did exactly what I wanted.