diff --git a/context.go b/context.go index f5dd5a69d..3c922b5b5 100644 --- a/context.go +++ b/context.go @@ -278,6 +278,9 @@ func (c *context) Scheme() string { if c.IsTLS() { return "https" } + if scheme := c.request.Header.Get(HeaderForwarded); scheme != "" { + return scheme + } if scheme := c.request.Header.Get(HeaderXForwardedProto); scheme != "" { return scheme } diff --git a/echo.go b/echo.go index 2d7d5bb8d..f348689c2 100644 --- a/echo.go +++ b/echo.go @@ -221,6 +221,7 @@ const ( HeaderUpgrade = "Upgrade" HeaderVary = "Vary" HeaderWWWAuthenticate = "WWW-Authenticate" + HeaderForwarded = "Forwarded" HeaderXForwardedFor = "X-Forwarded-For" HeaderXForwardedProto = "X-Forwarded-Proto" HeaderXForwardedProtocol = "X-Forwarded-Protocol"