summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy/reverseproxy.go
diff options
context:
space:
mode:
authorKevin Lin <masknu@users.noreply.github.com>2020-08-04 10:50:38 +0800
committerGitHub <noreply@github.com>2020-08-03 20:50:38 -0600
commit904f149e5b2f0ae9eff09dacb4f1ec41c4a76298 (patch)
tree52b831c3c70da560c62b5bda9132b11beee4c989 /modules/caddyhttp/reverseproxy/reverseproxy.go
parent8b80a3201fcddda3fcf125116d33555cb385a803 (diff)
reverse_proxy: fix bidirectional streams with encodings (fix #3606) (#3620)
* reverse_proxy: fix bi-h2stream breaking gzip encode handle(#3606). * reverse_proxy: check http version of both sides to avoid affecting non-h2 upstream. * Minor cleanup; apply review suggestions Co-authored-by: Matthew Holt <mholt@users.noreply.github.com>
Diffstat (limited to 'modules/caddyhttp/reverseproxy/reverseproxy.go')
-rw-r--r--modules/caddyhttp/reverseproxy/reverseproxy.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index 0a53db4..7fdf55a 100644
--- a/modules/caddyhttp/reverseproxy/reverseproxy.go
+++ b/modules/caddyhttp/reverseproxy/reverseproxy.go
@@ -613,8 +613,8 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, di Dia
// some apps need the response headers before starting to stream content with http2,
// so it's important to explicitly flush the headers to the client before streaming the data.
- // (see https://github.com/caddyserver/caddy/issues/3556 for use case)
- if req.ProtoMajor == 2 && res.ContentLength == -1 {
+ // (see https://github.com/caddyserver/caddy/issues/3556 for use case and nuances)
+ if h.isBidirectionalStream(req, res) {
if wf, ok := rw.(http.Flusher); ok {
wf.Flush()
}