Issue Description
ProcessStreamingResponseBody is skipped when the response has Content-Encoding.
Describe what happened
In our environment, we can repeatedly observe:
- when response header contains
Content-Encoding: gzip, ProcessStreamingResponseBody is not executed;
- when response has no
Content-Encoding, ProcessStreamingResponseBody is executed normally.
Important clarification:
- request
Accept-Encoding is only an indirect factor;
- the direct trigger appears to be whether response
Content-Encoding is present.
From current code reading, this seems related to wrapper behavior:
pkg/wrapper/request_wrapper.go: IsBinaryResponseBody() returns true if content-encoding is non-empty;
pkg/wrapper/plugin_wrapper.go: response header phase may set needResponseBody=false, then response-body callbacks are skipped.
If there is an exception, please attach the exception trace:
No panic/stack trace. This is behavior mismatch in callback triggering.
Describe what you expected to happen
Expected behavior:
- plugins registered with
ProcessStreamingResponseBody should have deterministic callback behavior;
- response compression should not silently disable callbacks without explicit configuration or clear warning.
How to reproduce it (as minimally and precisely as possible)
- Deploy a route with a WASM plugin that registers
ProcessStreamingResponseBody.
- Route traffic to an upstream endpoint that always returns compressed response (
Content-Encoding: gzip).
- Send a normal request to that route and check plugin/gateway logs.
- Observe callback is not triggered (
callback=NOT_EXECUTED).
- Switch to an uncompressed upstream endpoint (
Content-Encoding absent) and call again.
- Observe callback is triggered (
callback=EXECUTED).
Anything else we need to know?
Relevant log evidence from our run:
- compressed response:
response.content-encoding="gzip" with callback=NOT_EXECUTED
- uncompressed response:
response.content-encoding="" with callback=EXECUTED
Potential improvements that would help users:
- add a configurable option to keep response-body callbacks enabled when
Content-Encoding exists (raw bytes acceptable);
- optionally support transparent decompression before callback;
- if current behavior is intentional, add explicit docs/log hints.
Environment:
- Higress version: v2.1.9
- Others: reproducible with custom WASM plugin using
ProcessStreamingResponseBody
Issue Description
ProcessStreamingResponseBodyis skipped when the response hasContent-Encoding.Describe what happened
In our environment, we can repeatedly observe:
Content-Encoding: gzip,ProcessStreamingResponseBodyis not executed;Content-Encoding,ProcessStreamingResponseBodyis executed normally.Important clarification:
Accept-Encodingis only an indirect factor;Content-Encodingis present.From current code reading, this seems related to wrapper behavior:
pkg/wrapper/request_wrapper.go:IsBinaryResponseBody()returns true ifcontent-encodingis non-empty;pkg/wrapper/plugin_wrapper.go: response header phase may setneedResponseBody=false, then response-body callbacks are skipped.If there is an exception, please attach the exception trace:
Describe what you expected to happen
Expected behavior:
ProcessStreamingResponseBodyshould have deterministic callback behavior;How to reproduce it (as minimally and precisely as possible)
ProcessStreamingResponseBody.Content-Encoding: gzip).callback=NOT_EXECUTED).Content-Encodingabsent) and call again.callback=EXECUTED).Anything else we need to know?
Relevant log evidence from our run:
response.content-encoding="gzip"withcallback=NOT_EXECUTEDresponse.content-encoding=""withcallback=EXECUTEDPotential improvements that would help users:
Content-Encodingexists (raw bytes acceptable);Environment:
ProcessStreamingResponseBody