git.iko.soy/typeable/oauth2-proxy
on master help sign in
Check `X-Forwared-Proto` for https (via another reverse proxy)

Signed-off-by: Josh Michielsen <github@mickey.dev>

commitdcc430f6f141f2dc4071952ae2f6c3e7a1e15979 authorJosh Michielsen <github@mickey.dev> dateMon 21 Oct 2019, 23:21 (7 years ago) parent052451e
1 file changed+2−1
http.go+2−1
http.go+2−1
@@ -155,7 +155,8 @@ func (ln tcpKeepAliveListener) Accept() (c net.Conn, err error) {
155155
156156func redirectToHTTPS(opts *Options, h http.Handler) http.Handler {
157157 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
158− if opts.ForceHTTPS && r.TLS == nil {
158+ proto := r.Header.Get("X-Forwarded-Proto")
159+ if opts.ForceHTTPS && r.TLS == nil && strings.ToLower(proto) != "https" {
159160 http.Redirect(w, r, opts.HTTPSAddress, http.StatusPermanentRedirect)
160161 }
161162