Handle upstreams without a trailing slash

This commit is contained in:
Danilo Bargen 2014-07-08 15:00:55 +02:00
parent 14e845d021
commit b3bbc3ca20

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))