providers/proxy: fix backend override persisting for other users
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
1415b68ff4
commit
6021fc0f52
|
@ -71,18 +71,20 @@ func (a *Application) configureProxy() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Application) proxyModifyRequest(u *url.URL) func(req *http.Request) {
|
func (a *Application) proxyModifyRequest(ou *url.URL) func(req *http.Request) {
|
||||||
return func(r *http.Request) {
|
return func(r *http.Request) {
|
||||||
claims, _ := a.getClaims(r)
|
claims, _ := a.getClaims(r)
|
||||||
if claims.Proxy.BackendOverride != "" {
|
if claims.Proxy.BackendOverride != "" {
|
||||||
var err error
|
u, err := url.Parse(claims.Proxy.BackendOverride)
|
||||||
u, err = url.Parse(claims.Proxy.BackendOverride)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.log.WithField("backend_override", claims.Proxy.BackendOverride).WithError(err).Warning("failed parse user backend override")
|
a.log.WithField("backend_override", claims.Proxy.BackendOverride).WithError(err).Warning("failed parse user backend override")
|
||||||
}
|
}
|
||||||
|
r.URL.Scheme = u.Scheme
|
||||||
|
r.URL.Host = u.Host
|
||||||
|
} else {
|
||||||
|
r.URL.Scheme = ou.Scheme
|
||||||
|
r.URL.Host = ou.Host
|
||||||
}
|
}
|
||||||
r.URL.Scheme = u.Scheme
|
|
||||||
r.URL.Host = u.Host
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue