git.iko.soy/typeable/oauth2-proxy
on master help sign in
Confirm that the proto is not empty, and change condition to OR

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>

commitc0bfe0357a06339831f50a997a6708ea18ac745b authorJosh Michielsen <github@mickey.dev> dateTue 22 Oct 2019, 14:21 (7 years ago) parentfe9efba
1 file changed+1−1
http.go+1−1
http.go+1−1
@@ -156,7 +156,7 @@ func (ln tcpKeepAliveListener) Accept() (c net.Conn, err error) {
156156func redirectToHTTPS(opts *Options, h http.Handler) http.Handler {
157157 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
158158 proto := r.Header.Get("X-Forwarded-Proto")
159− if opts.ForceHTTPS && r.TLS == nil && strings.ToLower(proto) != "https" {
159+ if opts.ForceHTTPS && (r.TLS == nil || (proto != "" && strings.ToLower(proto) != "https")) {
160160 http.Redirect(w, r, opts.HTTPSAddress, http.StatusPermanentRedirect)
161161 }
162162