envoyproxy / envoyproxy/gateway
Support allowOnHeadersStopIteration in EnvoyExtensionPolicy Wasm spec
- Dominant language
- Go
- Stars
- 3k
- Forks
- 864
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 140
Description
*Description*:
>Add support for the `allow_on_headers_stop_iteration` field (field 9 of `extensions.wasm.v3.PluginConfig`) in the `EnvoyExtensionPolicy` Wasm spec.
>
>**Current behavior**: The internal translator (`internal/xds/translator/wasm.go`) populates `PluginConfig` with only `Name`, `Vm`, `Configuration`, `RootId`, and `FailOpen`. The `AllowOnHeadersStopIteration` field is never set, so there is no way to configure it without using `EnvoyPatchPolicy` with fragile or complex patches.
>
>**Desired behavior**: Expose `allowOnHeadersStopIteration` as an optional `*bool` field on the `Wasm` struct in `EnvoyExtensionPolicy`, mirroring how `failOpen` was already added. The translator would then conditionally set `filterConfig.Config.AllowOnHeadersStopIteration = wrapperspb.Bool(true)` when the field is present.
>
>**What this enables**: When a Proxy-Wasm plugin returns `FilterHeadersStatus::StopIteration` from `onRequestHeaders` or `onResponseHeaders` (e.g., to perform async operations or pause filter chain processing), Envoy currently ignores this return value unless `allow_on_headers_stop_iteration: true` is set on the `PluginConfig`. Without this field exposed in the EG API, users are forced to work around it via `EnvoyPatchPolicy`, which is experimental and requires complex JSONPath expressions to avoid fragile index-based paths.
>
>**Proposed API change** (`api/v1alpha1/wasm_types.go`):
>```go
>// AllowOnHeadersStopIteration allows the Wasm plugin to return
>// StopIteration from onRequestHeaders/onResponseHeaders callbacks.
>// Requires Envoy >= v1.35.
>// +optional
>AllowOnHeadersStopIteration *bool `json:"allowOnHeadersStopIteration,omitempty"`
>```
*Relevant Links*:
>- [`extensions.wasm.v3.PluginConfig` proto — field 9](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/wasm/v3/wasm.proto#extensions-wasm-v3-pluginconfig)
>- [`go-control-plane` PluginConfig binding](https://pkg.go.dev/github.com/envoyproxy/go-control-plane/envoy/extensions/wasm/v3#PluginConfig)
>- [Envoy Gateway WASM translator `internal/xds/translator/wasm.go`](https://github.com/envoyproxy/gateway/blob/main/internal/xds/translator/wasm.go)
>- [How `failOpen` was added to the Wasm spec](https://github.com/envoyproxy/gateway/blob/main/api/v1alpha1/wasm_types.go)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.