Handle upstreams without a trailing slash
commitb3bbc3ca20c79df5c62d2cc4ef8e9aaea0a3838b
authorDanilo Bargen <mail@dbrgn.ch>
dateTue 8 Jul 2014, 15:00 (12 years ago)
parent14e845d
oauthproxy.go+3
@@ -43,6 +43,9 @@ func NewOauthProxy(proxyUrls []*url.URL, clientID string, clientSecret string, v
4343 serveMux := http.NewServeMux()
4444 for _, u := range proxyUrls {
4545 path := u.Path
46+ if len(path) == 0 {
47+ path = "/"
48+ }
4649 u.Path = ""
4750 log.Printf("mapping %s => %s", path, u)
4851 serveMux.Handle(path, httputil.NewSingleHostReverseProxy(u))