Skip to content

Commit

Permalink
Refactor DefaultProxyConfig Skipper & WebSocket Check in Context (lab…
Browse files Browse the repository at this point in the history
…stack#1297)

* refactor: default to DefaultProxyConfig.Skipper if not provided

* refactor: use strings library for websocket check
  • Loading branch information
hemachandarv authored and vishr committed Mar 2, 2019
1 parent 802fb5b commit 775b2ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (c *context) IsTLS() bool {

func (c *context) IsWebSocket() bool {
upgrade := c.request.Header.Get(HeaderUpgrade)
return upgrade == "websocket" || upgrade == "Websocket"
return strings.ToLower(upgrade) == "websocket"
}

func (c *context) Scheme() string {
Expand Down
2 changes: 1 addition & 1 deletion middleware/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func Proxy(balancer ProxyBalancer) echo.MiddlewareFunc {
func ProxyWithConfig(config ProxyConfig) echo.MiddlewareFunc {
// Defaults
if config.Skipper == nil {
config.Skipper = DefaultLoggerConfig.Skipper
config.Skipper = DefaultProxyConfig.Skipper
}
if config.Balancer == nil {
panic("echo: proxy middleware requires balancer")
Expand Down

0 comments on commit 775b2ee

Please sign in to comment.