Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httploc.HttpLocation should ensure that the endpoint host is respected #50

Open
davidbirdsong opened this issue Jun 12, 2014 · 2 comments

Comments

@davidbirdsong
Copy link
Contributor

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 davidbirdsong changed the title httploc. HttpLocation should ensure that the endpoint host is respected httploc.HttpLocation should ensure that the endpoint host is respected Jun 12, 2014
@klizhentas
Copy link
Contributor

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

@davidbirdsong
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants