Here my use case
We have one services "foobar" which has two version legacy
and version_2_of_doom
(both in go)
In order to make the transition from legacy
to version_2_of_doom
, we would like in a first time, to have the two version alongside, and have the POST request (as there's only one POST api call in this ) received on both.
The way I see how to do it. Would be
-
modifying the code of
legacy
at the beginning of the handler, in order to duplicate the request toversion_2_of_doom
func(w http.ResponseWriter, req *http.Request) { req.URL.Host = "v2ofdoom.local:8081" req.Host = "v2ofdoom.local:8081" client := &http.Client{} client.Do(req) // legacy code
but it seems to not be as straightforward as this
it fails with http: Request.RequestURI can't be set in client requests.
Is there a well-known method to do this kind of action (i.e transfering without touching) a http.Request
to an other server ?