-
Notifications
You must be signed in to change notification settings - Fork 324
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
Client Host header not sent #18
Comments
@martensson Is the |
@KensoDev from my tests it seems all other Headers are passed just fine, it's just the But the I did some more digging into the code and saw that we can actually just remove the following two lines: https://github.com/mailgun/oxy/blob/master/forward/fwd.go#L125-L126 and it would solve the whole problem. Even better than my previous PR and saves two unnecessary lines of code. :) |
+1, have this same problem. currently we hacked in a patch to copy the host header and XFH from the original request, not from the target url: --- a/Godeps/_workspace/src/github.com/mailgun/oxy/forward/fwd.go
+++ b/Godeps/_workspace/src/github.com/mailgun/oxy/forward/fwd.go
@@ -147,5 +147,11 @@ func (f *Forwarder) copyRequest(req *http.Request, u *url.URL) *http.Request {
if f.rewriter != nil {
f.rewriter.Rewrite(outReq)
}
+
+ // TODO(pquerna): HACK HACK HACK HACK HACK HACK
+ // We need to fix Header Host mapping in vulcan.
+ outReq.Header.Set(XForwardedHost, req.Host)
+ outReq.Host = req.Host
+
return outReq
} |
CC @klizhentas |
@pquerna this is already fixed in a PR some weeks ago :) |
Hi! I'm still experiencing the same bug. Is it really fixed in that PR? |
@uaalto it should work fine, did you set the option? https://godoc.org/github.com/mailgun/oxy/forward#PassHostHeader |
Hi,
Yes I did. However, I ended up building a custom middleware because I needed further control, but IRCC, the URL had an empty host. It might have been caused by any of my other middlewares, so unless other users have the same issue again I think it can be ignored.
Thanks!
|
hmm I am running my own proxy with oxy in the core without problem, and I am getting the client host headers as well. Well I am glad it worked out for you! :) |
couldn't get it working in vulcan, so we are still applying the patch to oxy. |
Hi @klizhentas !
First thanks for this great library and open sourcing it. I am currently using it in a different project (https://github.com/martensson/moxy) and it's working great so far. But I encountered a deal breaking bug that would be nice to fix, which is that oxy does not respect the clients Host header being sent.
This causes problems when you want to route traffic to nodes that respond differently depending on vhost settings.
Being a transparent reverse proxy the library should maintain all header as they are unless its a way to override them at least. I checked the code and saw a quick fix to the problem, and there is a PR that you can check out.
If you believe there is a better way of doing it please tell me, if not I will have to fork oxy just because of this small fix, and I hope not :/
Thanks!
Best regards,
Benjamin
The text was updated successfully, but these errors were encountered: