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
net/http/httputil: NewSingleHostReverseProxy fails to transparently send requests #10342
Comments
CC @bradfitz |
I think you misunderstand what "reverse proxy" means here. In short, the reverse proxy is actually acting as the server for |
@minux I understand what a reverse proxy is. I may have misunderstand the purpose of NewSingleHostReverseProxy. |
Had the same problem. Doesn't seem quite clear that the host doesn't change. Maybe a docfix? |
CL https://golang.org/cl/15630 mentions this issue. |
I seems that NewSingleHostReverseProxy does not work, at least not how I would expected it to.
The program below demonstrates the correct and incorrect behavior.
The problem is that the director function do not reset the Host field of the request received by the proxy.
This is ok if the server is used as a real proxy:
works perfectly well.
However it was my understanding that the goal of NewSingleHostReverseProxy was to transparently proxy requests to a given http server:
won't work as localhost:8000 is sent as the Host header of the request to the proxied server.
The text was updated successfully, but these errors were encountered: