Duplicate traffic to parallel upstreams simultaneously

I came across pretty much the same use case as described in How to duplicate traffic using http proxy. I want to replicate incoming live traffic to a second test instance of my app to test it in a realistic setting (and simply drop its responses). Basically the “mirroring” feature of Traefik or what ngx_http_mirror_module does for nginx.

Is there a way to achieve this with Caddy?

As mentioned on the GitHub page I posted above, if all you need to do is mirror the URL request with headers (GET method, so no request body), you might be able to bend forward_auth to your needs.

I’d need to duplicate the entire request, including body.

Sadly, no such feature exists at the moment. You should probably add your voice to that feature request on GitHub - if more people ask for it, @matt and the team might take a closer look. I wish I knew Golang better so I could help with it.

Ah yeah, every ~2-3 years or so, we get someone requesting this feature. It’s not particularly common, apparently.

I would love to see someone implement a Proxy Transport module that does this if anyone wants to take a stab at it. I’m not sure it’s super simple, but maybe it is. I haven’t used or needed a feature like this so I don’t know yet.

But, I could prioritize development of something like this if a sponsor would like to fund it!