I am using caddy as reverse proxy on my server. What I am trying to do now, is that when the proxy recieves an http request, it has to act as a proxy as usuail sending it to the corresponding service (Service A) but in addition, I want to send the same request to anoher service (Service B). I don’t need to keep the response from Service B since this is just for testing purposes.
I tried several things on my caddyfile. What I have now is:
mydomain.com {
proxy / {
transparent
upstream localhost:8500 (this is Service A)
upstream localhost:8501 (this is Service B)
}
tls mymail@mail.com
}
I tried to duplicate the whole proxy block (one for each service) and I also tried to put a single upstream using port ranges instead of putting it twice, but nothing works. It sends the request to one service or another, but never at both.
Do you know how can I do this or what I am doing wrong?
In my case is a workaround to test new features of a service with real traffic. In fact, Service B is a new version of Service A, and Service A is the “production” version. So with this I can test new features with real cases.
About the responses, in my case I don’t need them because my service just takes the information from te reqeust, make some calcs and take some actions, but nothing is returned to the user. Anyway, for a generic case, maybe the responses should be stored somewhere or maybe logged.
It this possible to do right now? Do you need me to create an issue in github explaining this case?