<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <link href="../01-bootstrap.min.css" type="text/css" rel="StyleSheet"/> <link href="../02-docstyle.css" type="text/css" rel="StyleSheet"/> <link href="../syntax.css" type="text/css" rel="StyleSheet"/> <title>mitmproxy 0.9 - Server-side replay</title></head><body><div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand" href="../index.html">mitmproxy 0.9 docs</a> </div><!--/.nav-collapse --> </div> </div> </div> <div class="container"> <div class="row"> <div class="span3"> <div class="well sidebar-nav"> <ul class="nav nav-list"> <li><a href="../index.html">Introduction</a></li> <li><a href="../install.html">Installation</a></li> <li><a href="../howmitmproxy.html">How mitmproxy works</a></li> <li class="nav-header">Tools</li> <li><a href="../mitmproxy.html">mitmproxy</a></li> <li><a href="../mitmdump.html">mitmdump</a></li> <li class="nav-header">Features</li> <li><a href="anticache.html">Anticache</a></li> <li><a href="clientreplay.html">Client-side replay</a></li> <li><a href="filters.html">Filter expressions</a></li> <li><a href="proxyauth.html">Proxy Authentication</a></li> <li><a href="replacements.html">Replacements</a></li> <li class="active"><a href="serverreplay.html">Server-side replay</a></li> <li><a href="setheaders.html">Set Headers</a></li> <li><a href="sticky.html">Sticky cookies and auth</a></li> <li><a href="reverseproxy.html">Reverse proxy mode</a></li> <li><a href="upstreamcerts.html">Upstream Certs</a></li> <li class="nav-header">Installing Certificates</li> <li><a href="../ssl.html">Overview</a></li> <li><a href="../certinstall/firefox.html">Firefox</a></li> <li><a href="../certinstall/osx.html">OSX</a></li> <li><a href="../certinstall/windows7.html">Windows 7</a></li> <li><a href="../certinstall/ios.html">IOS</a></li> <li><a href="../certinstall/ios-simulator.html">IOS Simulator</a></li> <li><a href="../certinstall/android.html">Android</a></li> <li class="nav-header">Transparent Proxying</li> <li><a href="../transparent.html">Overview</a></li> <li><a href="../transparent/linux.html">Linux</a></li> <li><a href="../transparent/osx.html">OSX</a></li> <li class="nav-header">Tutorials</li> <li><a href="../tutorials/30second.html">Client playback: a 30 second example</a></li> <li><a href="../tutorials/gamecenter.html">Setting highscores on Apple's GameCenter</a></li> <li class="nav-header">Scripting mitmproxy</li> <li><a href="../scripting/inlinescripts.html">Inline Scripts</a></li> <li><a href="../scripting/libmproxy.html">libmproxy</a></li> <li class="nav-header">Hacking</li> <li><a href="../dev/testing.html">Testing</a></li> </ul> </div> </div> <div class="span9"> <div class="page-header"> <h1>Server-side replay</h1> </div> <ul> <li>command-line: <em>-S path</em> </li> <li>mitmproxy shortcut: <em>S</em></li> </ul> <p>Server-side replay lets us replay server responses from a saved HTTP conversation.</p> <h2>Matching requests with responses</h2> <p>By default, <strong>mitmproxy</strong> excludes request headers when matching incoming requests with responses from the replay file. This works in most circumstances, and makes it possible to replay server responses in situations where request headers would naturally vary, e.g. using a different user agent. The <em>--rheader headername</em> command-line option allows you to override this behaviour by specifying individual headers that should be included in matching.</p> <h2>Response refreshing</h2> <p>Simply replaying server responses without modification will often result in unexpected behaviour. For example cookie timeouts that were in the future at the time a conversation was recorded might be in the past at the time it is replayed. By default, <strong>mitmproxy</strong> refreshes server responses before sending them to the client. The <strong>date</strong>, <strong>expires</strong> and <strong>last-modified</strong> headers are all updated to have the same relative time offset as they had at the time of recording. So, if they were in the past at the time of recording, they will be in the past at the time of replay, and vice versa. Cookie expiry times are updated in a similar way.</p> <p>You can turn off response refreshing using the <em>--norefresh</em> argument, or using the <em>o</em> options shortcut within <strong>mitmproxy</strong>.</p> </div> </div> <hr> <footer> <p>© mitmproxy project, 2013</p> </footer> </div> </body></html>