git.iko.soy/typeable/oauth2-proxy
on master help sign in
Check `X-Forwared-Proto` for https (via another reverse proxy)
dcc430fJosh Michielsen
http.go+2−1
@@ -155,7 +155,8 @@ func (ln tcpKeepAliveListener) Accept() (c net.Conn, err error) {
155
155
156func redirectToHTTPS(opts *Options, h http.Handler) http.Handler {
156func redirectToHTTPS(opts *Options, h http.Handler) http.Handler {
157 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
157 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
158+ proto := r.Header.Get("X-Forwarded-Proto")
158− if opts.ForceHTTPS && r.TLS == nil {
159+ if opts.ForceHTTPS && r.TLS == nil && strings.ToLower(proto) != "https" {
159 http.Redirect(w, r, opts.HTTPSAddress, http.StatusPermanentRedirect)
160 http.Redirect(w, r, opts.HTTPSAddress, http.StatusPermanentRedirect)
160 }
161 }
161
162