Skip to content

Commit

Permalink
Fix issue 2694.add Forwarded in header
Browse files Browse the repository at this point in the history
  • Loading branch information
debug-ing committed Nov 15, 2024
1 parent 5a0b4dd commit c094404
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c094404

Please sign in to comment.