mirror of
https://github.com/niusmallnan/steve.git
synced 2025-06-27 06:56:55 +00:00
Set x-forwarded-proto if unset and needed.
This commit is contained in:
parent
1971d57a31
commit
1b98deb6c9
@ -109,12 +109,15 @@ func Handler(prefix string, cfg *rest.Config) (http.Handler, error) {
|
||||
handler = stripLeaveSlash(prefix, handler)
|
||||
}
|
||||
|
||||
return authHeaders(handler), nil
|
||||
return proxyHeaders(handler), nil
|
||||
}
|
||||
|
||||
func authHeaders(handler http.Handler) http.Handler {
|
||||
func proxyHeaders(handler http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||
req.Header.Del("Authorization")
|
||||
if req.Header.Get("X-Forwarded-Proto") == "" && req.TLS != nil {
|
||||
req.Header.Set("X-Forwarded-Proto", "https")
|
||||
}
|
||||
handler.ServeHTTP(rw, req)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user