plano/envoyfilter/README.md
José Ulises Niño Rivera 913a3f50d7 comments
Signed-off-by: José Ulises Niño Rivera <junr03@users.noreply.github.com>
2024-07-10 13:47:26 -07:00

1 KiB

Envoy filter code for gateway

Add toolchain

$ rustup target add wasm32-wasi

Building

$ cargo build --target wasm32-wasi --release

Using in Envoy

This example can be run with docker compose and has a matching Envoy configuration.

$ docker compose up

Examples

Direct response.

Send HTTP request to localhost:10000/hello:

$ curl localhost:10000/hello

Expected response:

HTTP/1.1 200 OK
content-length: 40
content-type: text/plain
custom-header: katanemo filter
date: Wed, 10 Jul 2024 16:59:43 GMT
server: envoy

Inline call.

Send HTTP request to localhost:10000/inline:

$ curl localhost:10000/hello
{
  "headers": {
    "Accept": "*/*",
    "Host": "localhost",
    "User-Agent": "curl/7.81.0",
    "X-Amzn-Trace-Id": "Root=1-637c4767-6e31776a0b407a0219b5b570",
    "X-Envoy-Expected-Rq-Timeout-Ms": "15000"
  }
}

Expected Envoy logs:

[...] wasm log http_auth_random: Access granted.