mirror of
https://github.com/labstack/echo.git
synced 2024-11-28 08:38:39 +02:00
Get The HeaderXForwardedProto (#941)
* Get The HeaderXForwardedProto https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto * add HeaderXForwardedSsl * Get The HeaderXForwardedSsl
This commit is contained in:
parent
68b89eca6c
commit
353a2f8b78
@ -225,6 +225,12 @@ func (c *context) Scheme() string {
|
||||
if c.IsTLS() {
|
||||
return "https"
|
||||
}
|
||||
if scheme := c.request.Header.Get(HeaderXForwardedProto); scheme != "" {
|
||||
return scheme
|
||||
}
|
||||
if ssl := c.request.Header.Get(HeaderXForwardedSsl); ssl == "on" {
|
||||
return "https"
|
||||
}
|
||||
return "http"
|
||||
}
|
||||
|
||||
|
1
echo.go
1
echo.go
@ -184,6 +184,7 @@ const (
|
||||
HeaderXForwardedProto = "X-Forwarded-Proto"
|
||||
HeaderXHTTPMethodOverride = "X-HTTP-Method-Override"
|
||||
HeaderXForwardedFor = "X-Forwarded-For"
|
||||
HeaderXForwardedSsl = "X-Forwarded-Ssl"
|
||||
HeaderXRealIP = "X-Real-IP"
|
||||
HeaderXRequestID = "X-Request-ID"
|
||||
HeaderServer = "Server"
|
||||
|
Loading…
Reference in New Issue
Block a user