Merge pull request #574 from scrapinghub/bugfix-endlessloop

Detect https scheme when serving ssl
This commit is contained in:
Brad Rydzewski 2014-10-15 08:23:56 -07:00
commit b69a62b488

View file

@ -13,6 +13,8 @@ func IsHttps(r *http.Request) bool {
switch {
case r.URL.Scheme == "https":
return true
case r.TLS != nil:
return true
case strings.HasPrefix(r.Proto, "HTTPS"):
return true
case r.Header.Get("X-Forwarded-Proto") == "https":
@ -30,6 +32,8 @@ func GetScheme(r *http.Request) string {
switch {
case r.URL.Scheme == "https":
return "https"
case r.TLS != nil:
return "https"
case strings.HasPrefix(r.Proto, "HTTPS"):
return "https"
case r.Header.Get("X-Forwarded-Proto") == "https":