# Server replay with POST

**URL:** <https://discourse.mitmproxy.org/t/server-replay-with-post/472>\
**Category:** help\
**Created:** [May 9, 2017, 4:31pm UTC](https://discourse.mitmproxy.org/t/server-replay-with-post/472 "2017-05-09T16:31:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![galactic\_cowboy](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@galactic\_cowboy](https://discourse.mitmproxy.org/u/galactic_cowboy)\
**Post date:** [May 9, 2017, 4:31pm UTC](https://discourse.mitmproxy.org/t/server-replay-with-post/472/1 "2017-05-09T16:31:52Z")

</div>

I have a bunch of captured flows that include some POST requests to the same URL with different bodies, and corresponding different responses.

I want to replay these using -S in an offline scenario. However, if I do not specify the --replay-ignore-content header the requests are not matched (so connection is killed because I use -k to enforce that it’s offline only because I don’t want to hit the third-party server while testing this) and if I _do_ specify --replay-ignore-content then all of the POST requests return the same response (the first one in the file) because the content isn’t included in the match.

Is there a way to see what isn’t matching correctly in the first scenario so I can have different POSTs to the same URL? So far I have verified the method, scheme, host, port, path, and query string, and the content _appears_ to be correct as well.

I am not specifying --norefresh, --server-replay-use-header, etc. I _am_ specifying --no-pop so that I don’t have to restart the proxy to return the same content multiple times. (I want it to vary by the request content)

---

<div class="post-metadata">

**Author:** ![galactic\_cowboy](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@galactic\_cowboy](https://discourse.mitmproxy.org/u/galactic_cowboy)\
**Post date:** [May 11, 2017, 1:29pm UTC](https://discourse.mitmproxy.org/t/server-replay-with-post/472/2 "2017-05-11T13:29:36Z")

</div>

I have stopped using --no-pop for now so that I can progress, but this results in the server replaying the messages in the order they were originally captured, regardless of the message body. This is less than ideal from a testing standpoint since _any_ POST to a particular route pops the next response message, resulting in there being no relationship between what is posted and what is returned.

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [May 21, 2017, 2:02pm UTC](https://discourse.mitmproxy.org/t/server-replay-with-post/472/3 "2017-05-21T14:02:27Z")

</div>

Hi @galactic_cowboy,

Sorry for the late reply - if you want to find out what’s different, I would recommend adding a `print(key)` here: [https://github.com/mitmproxy/mitmproxy/blob/2.0.x/mitmproxy/addons/serverplayback.py#L75](https://github.com/mitmproxy/mitmproxy/blob/2.0.x/mitmproxy/addons/serverplayback.py#L75)

---

<div class="post-metadata">

**Author:** ![galactic\_cowboy](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@galactic\_cowboy](https://discourse.mitmproxy.org/u/galactic_cowboy)\
**Post date:** [May 22, 2017, 1:33pm UTC](https://discourse.mitmproxy.org/t/server-replay-with-post/472/4 "2017-05-22T13:33:18Z")

</div>

Thanks, that’s pretty much exactly what I ended up doing. (Logged to file, but same concept.)

Turned out that it was my own fault. I had translated the dump file to json, _thought_ I had made some modifications, then back to tnetstrings. However, for these forms it was using the original data instead of my modifications because I forgot to change a flag in my software that translated it back and forth. Once I realized that, I was able to test with the original data to prove it worked, then _actually_ make my modifications and test that it still worked.

So everything seems to work as expected now.
