Skip to content

Commit 471e452

Browse files
wasm: add config setting to control StopIteration behavior (#40213)
Add PluginConfig.allow_on_headers_stop_iteration config field to control the behavior of WasmFilter when plugin onRequestHeaders and onResponseHeaders callbacks return a value of FilterHeadersStatus::StopIteration. If allow_on_headers_stop_iteration is false (the default), then in cases where a Wasm plugin onRequestHeaders or onResponseHeaders callback returns FilterHeadersStatus::StopIteration, WasmFilter will maintain its current behavior of translating that response code to FilterHeadersStatus::StopAllIterationAndWatermark. If allow_on_headers_stop_iteration is true, then WasmFilter will avoid any translation of FilterHeadersStatus::StopIteration, and will pass it through to HCM unmodified, which allows Wasm plugins to inspect request or response body data before deciding how to handle/transform request or response headers. For details, see [Envoy Wasm / Proxy-Wasm support for FilterHeadersStatus::StopIteration](https://docs.google.com/document/d/1Whd1C0k-H2NHrPOmlAqqauFz6ObSTP017juJIYyciB0/edit?usp=sharing). This PR implements [Option B: WasmFilter config knob](https://docs.google.com/document/d/1Whd1C0k-H2NHrPOmlAqqauFz6ObSTP017juJIYyciB0/edit?tab=t.0#bookmark=id.5wxldlapsp54), building on proxy-wasm/proxy-wasm-cpp-host#434. Note that this config knob is a stopgap until upcoming v0.3.0 of the Proxy-Wasm ABI adds more comprehensive support for StopIteration and body buffering, per proxy-wasm/spec#63. Additional Description: This change updates the proxy-wasm-cpp-host dependency since it depends on proxy-wasm/proxy-wasm-cpp-host#434, which was recently merged there. Signed-off-by: Michael Warres <mpw@google.com> Mirrored from https://github.com/envoyproxy/envoy @ 274d68f02971c1cf0da1628991126e8ebd307d25
1 parent 5485f23 commit 471e452

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

envoy/extensions/wasm/v3/wasm.proto

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import "envoy/config/core/v3/backoff.proto";
66
import "envoy/config/core/v3/base.proto";
77

88
import "google/protobuf/any.proto";
9+
import "google/protobuf/wrappers.proto";
910

1011
import "envoy/annotations/deprecation.proto";
1112
import "udpa/annotations/status.proto";
@@ -148,7 +149,7 @@ message EnvironmentVariables {
148149
}
149150

150151
// Base Configuration for Wasm Plugins e.g. filters and services.
151-
// [#next-free-field: 9]
152+
// [#next-free-field: 10]
152153
message PluginConfig {
153154
// A unique name for a filters/services in a VM for use in identifying the filter/service if
154155
// multiple filters/services are handled by the same ``vm_id`` and ``root_id`` and for
@@ -192,6 +193,10 @@ message PluginConfig {
192193

193194
// Configuration for restricting Proxy-Wasm capabilities available to modules.
194195
CapabilityRestrictionConfig capability_restriction_config = 6;
196+
197+
// Whether or not to allow plugin onRequestHeaders and onResponseHeaders callbacks to return
198+
// FilterHeadersStatus::StopIteration.
199+
google.protobuf.BoolValue allow_on_headers_stop_iteration = 9;
195200
}
196201

197202
// WasmService is configured as a built-in ``envoy.wasm_service`` :ref:`WasmService

0 commit comments

Comments
 (0)