Merge pull request #22 from dbrgn/empty_upstream_path

Handle upstreams without a trailing slash
This commit is contained in:
Jehiah Czebotar 2014-11-08 19:17:44 +01:00
commit 23a89b06de

View File

@ -43,6 +43,9 @@ func NewOauthProxy(proxyUrls []*url.URL, clientID string, clientSecret string, v
serveMux := http.NewServeMux() serveMux := http.NewServeMux()
for _, u := range proxyUrls { for _, u := range proxyUrls {
path := u.Path path := u.Path
if len(path) == 0 {
path = "/"
}
u.Path = "" u.Path = ""
log.Printf("mapping %s => %s", path, u) log.Printf("mapping %s => %s", path, u)
serveMux.Handle(path, httputil.NewSingleHostReverseProxy(u)) serveMux.Handle(path, httputil.NewSingleHostReverseProxy(u))