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

net/http/httputil: NewSingleHostReverseProxy doesn't pass http authentication #14469

Closed
amulyas opened this issue Feb 22, 2016 · 5 comments
Closed
Milestone

Comments

@amulyas
Copy link

amulyas commented Feb 22, 2016

I am using NewSingleHostReverseProxy its working well for us except it not passing any authentication if I pass the URL with auth its just ignoring auth, is there any way I can work around it

@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Feb 22, 2016
@mgenov
Copy link

mgenov commented Feb 23, 2016

You can write your own transport that wraps the default one.

https://golang.org/src/net/http/httputil/reverseproxy.go?s=564:1486#L34

@bradfitz
Copy link
Contributor

Yeah, I think @mgenov's suggestion is your best bet. I don't think we want to modify ReverseProxy at this point to support auth in URLs. In general, auth info in URLs is somewhat gross and deprecated, and I don't think we should be encouraging it.

@amulyas
Copy link
Author

amulyas commented Feb 23, 2016

@bradfitz if I add credentials in header will it work?

@bradfitz
Copy link
Contributor

Headers are propagated through the proxy.

@amulyas
Copy link
Author

amulyas commented Feb 23, 2016

thanks @bradfitz

@golang golang locked and limited conversation to collaborators Feb 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants