diff --git a/context.go b/context.go index b90d8db8..44822f2f 100644 --- a/context.go +++ b/context.go @@ -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" } diff --git a/echo.go b/echo.go index d80489c5..60733519 100644 --- a/echo.go +++ b/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"