mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-01-22 05:19:26 +02:00
Check X-Forwared-Proto
for https (via another reverse proxy)
Signed-off-by: Josh Michielsen <github@mickey.dev>
This commit is contained in:
parent
052451edef
commit
dcc430f6f1
3
http.go
3
http.go
@ -155,7 +155,8 @@ func (ln tcpKeepAliveListener) Accept() (c net.Conn, err error) {
|
|||||||
|
|
||||||
func redirectToHTTPS(opts *Options, h http.Handler) http.Handler {
|
func redirectToHTTPS(opts *Options, h http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
if opts.ForceHTTPS && r.TLS == nil {
|
proto := r.Header.Get("X-Forwarded-Proto")
|
||||||
|
if opts.ForceHTTPS && r.TLS == nil && strings.ToLower(proto) != "https" {
|
||||||
http.Redirect(w, r, opts.HTTPSAddress, http.StatusPermanentRedirect)
|
http.Redirect(w, r, opts.HTTPSAddress, http.StatusPermanentRedirect)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user