Skip to content

Commit

Permalink
providers/proxy: improve error handling for invalid backend_override
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <[email protected]>
  • Loading branch information
BeryJu committed Feb 7, 2022
1 parent 20c284a commit e758995
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/outpost/proxyv2/application/mode_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ func (a *Application) configureProxy() error {
func (a *Application) proxyModifyRequest(ou *url.URL) func(req *http.Request) {
return func(r *http.Request) {
claims, _ := a.getClaims(r)
r.URL.Scheme = ou.Scheme
r.URL.Host = ou.Host
if claims.Proxy != nil && claims.Proxy.BackendOverride != "" {
u, err := url.Parse(claims.Proxy.BackendOverride)
if err != nil {
a.log.WithField("backend_override", claims.Proxy.BackendOverride).WithError(err).Warning("failed parse user backend override")
return
}
r.URL.Scheme = u.Scheme
r.URL.Host = u.Host
} else {
r.URL.Scheme = ou.Scheme
r.URL.Host = ou.Host
}
}
}
Expand Down

0 comments on commit e758995

Please sign in to comment.