mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 11:51:02 +00:00
Detect https scheme when serving ssl
This commit is contained in:
parent
2f232b8c98
commit
94d7f12667
1 changed files with 4 additions and 0 deletions
|
@ -13,6 +13,8 @@ func IsHttps(r *http.Request) bool {
|
||||||
switch {
|
switch {
|
||||||
case r.URL.Scheme == "https":
|
case r.URL.Scheme == "https":
|
||||||
return true
|
return true
|
||||||
|
case r.TLS != nil:
|
||||||
|
return true
|
||||||
case strings.HasPrefix(r.Proto, "HTTPS"):
|
case strings.HasPrefix(r.Proto, "HTTPS"):
|
||||||
return true
|
return true
|
||||||
case r.Header.Get("X-Forwarded-Proto") == "https":
|
case r.Header.Get("X-Forwarded-Proto") == "https":
|
||||||
|
@ -30,6 +32,8 @@ func GetScheme(r *http.Request) string {
|
||||||
switch {
|
switch {
|
||||||
case r.URL.Scheme == "https":
|
case r.URL.Scheme == "https":
|
||||||
return "https"
|
return "https"
|
||||||
|
case r.TLS != nil:
|
||||||
|
return "https"
|
||||||
case strings.HasPrefix(r.Proto, "HTTPS"):
|
case strings.HasPrefix(r.Proto, "HTTPS"):
|
||||||
return "https"
|
return "https"
|
||||||
case r.Header.Get("X-Forwarded-Proto") == "https":
|
case r.Header.Get("X-Forwarded-Proto") == "https":
|
||||||
|
|
Loading…
Reference in a new issue