Wasm
Attention
The Wasm filter is experimental and is currently under active development. Capabilities will be expanded over time and the configuration structures are likely to change.
The HTTP Wasm filter is used to implement an HTTP filter with a Wasm plugin.
Note
This filter is not supported on Windows.
Example configuration
Example filter configuration:
24 route:
25 cluster: web_service
26
27 http_filters:
28 - name: envoy.filters.http.wasm
29 typed_config:
30 "@type": type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
31 config:
32 name: "my_plugin"
33 root_id: "my_root_id"
34 # if your wasm filter requires custom configuration you can add
35 # as follows
36 configuration:
37 "@type": "type.googleapis.com/google.protobuf.StringValue"
38 value: |
39 {}
40 vm_config:
41 vm_id: "my_vm_id"
42 code:
43 local:
44 filename: "lib/envoy_filter_http_wasm_example.wasm"
45 - name: envoy.filters.http.router
46 typed_config:
47 "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
48 - name: listener_1
49 address:
Example upstream filter configuration:
89 type: strict_dns
90 lb_policy: round_robin
91 load_assignment:
92 cluster_name: service1
93 endpoints:
94 - lb_endpoints:
95 - endpoint:
96 address:
97 socket_address:
98 address: web_service
99 port_value: 9000
100 typed_extension_protocol_options:
101 envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
102 "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
103 upstream_http_protocol_options:
104 auto_sni: false
105 auto_san_validation: false
106 explicit_http_config:
107 http2_protocol_options: {}
108 http_filters:
109 - name: envoy.filters.http.wasm
110 typed_config:
111 "@type": type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
112 config:
113 name: "my_plugin"
114 root_id: "my_root_id"
115 # if your wasm filter requires custom configuration you can add
116 # as follows
117 configuration:
118 "@type": "type.googleapis.com/google.protobuf.StringValue"
119 value: |
120 {}
121 vm_config:
122 vm_id: "my_vm_id"
123 code:
124 local:
125 filename: "lib/envoy_filter_http_wasm_example.wasm"
126 - name: envoy.filters.http.upstream_codec
127 typed_config:
128 "@type": type.googleapis.com/envoy.extensions.filters.http.upstream_codec.v3.UpstreamCodec
The preceding snippets configures a filter from a Wasm binary on local disk.