Skip to content

Commit

Permalink
proxy: only apply proxy timeout to non-websocket requests (#155)
Browse files Browse the repository at this point in the history
Updates the HTTP proxy (both server and agent) to only apply the timeout
to non-websocket requests.
  • Loading branch information
andydunstall authored Aug 15, 2024
1 parent 689648d commit 685afd2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion agent/reverseproxy/reverseproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewReverseProxy(conf config.ListenerConfig, logger log.Logger) *ReverseProx
}

func (p *ReverseProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if p.timeout != 0 {
if p.timeout != 0 && r.Header.Get("upgrade") != "websocket" {
ctx, cancel := context.WithTimeout(r.Context(), p.timeout)
defer cancel()

Expand Down
2 changes: 1 addition & 1 deletion server/proxy/httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (p *HTTPProxy) ServeHTTPWithUpstream(
endpointID string,
upstream upstream.Upstream,
) {
if p.timeout != 0 {
if p.timeout != 0 && r.Header.Get("upgrade") != "websocket" {
ctx, cancel := context.WithTimeout(r.Context(), p.timeout)
defer cancel()

Expand Down

0 comments on commit 685afd2

Please sign in to comment.