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()
for _, u := range proxyUrls {
path := u.Path
if len(path) == 0 {
path = "/"
}
u.Path = ""
log.Printf("mapping %s => %s", path, u)
serveMux.Handle(path, httputil.NewSingleHostReverseProxy(u))