vulcan icon indicating copy to clipboard operation
vulcan copied to clipboard

httploc.HttpLocation should ensure that the endpoint host is respected

Open davidbirdsong opened this issue 10 years ago • 2 comments

I'm pretty sure I have this right, but LMK if I'm wrong. Using my own Middleware to provide ProcessRequest it's too easy to override which host the RoundTripper will Dial thereby overriding which host I expect the Endpoint to specify.

request.Request.GetHttpRequest().URL is a pointer, so any edits to URL.Host are carry all the way through to the RoundTrip. Perhaps a quick override above this line to guarantee the Location dials the correct upstream host?

davidbirdsong avatar Jun 12 '14 22:06 davidbirdsong

Can you elaborate a bit more on this one? I'm trying to understand the use-case better.

klizhentas avatar Jul 04 '14 21:07 klizhentas

I've got Middleware the mucks with the http.Request object including the http.Request.URL object. I also have an Endpoint that explicitly sets the host that I want to the location to send to transport.RoundTrip

It's been awhile, but in my experience, I found that a Middleware.ProcessRequest that sets the http.Request.URL will affect which host is Dial'ed and that the host section of Endpoint.GetUrl() is not connected to.

Should this be the case? I figured Endpoint runs later and should override anything prior to it.

davidbirdsong avatar Jul 04 '14 22:07 davidbirdsong