-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add metadata example #289
base: main
Are you sure you want to change the base?
Add metadata example #289
Conversation
e5f9a4a
to
4077239
Compare
Signed-off-by: Martijn Swaagman <martijn@swaagman.online>
Signed-off-by: Martijn Swaagman <martijn@swaagman.online>
4077239
to
63e7058
Compare
Signed-off-by: Martijn Swaagman <martijn@swaagman.online>
body: | ||
inline_string: "Welcome, set the `x-custom-metadata` header to change the response!\n" | ||
http_filters: | ||
# Set metadata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Set metadata in Lua filter
local data = headers:get("x-custom-metadata") | ||
|
||
if data then | ||
request_handle:streamInfo():dynamicMetadata():set("envoy.filters.http.lua", "x-custom-metadata", data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking, but it would be slightly more realistic and easier to understand the flow if:
- Lua did something with the input (e.g. convert to uppercase),
- Metadata key would be different from the HTTP header name.
@@ -22,6 +22,7 @@ | |||
- [HTTP Response body](./examples/http_body/) | |||
- [HTTP Configuration](./examples/http_config/) | |||
- [gRPC Auth (random)](./examples/grpc_auth_random/) | |||
- [Filter metadata](./examples/filter_metadata/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rename this to Envoy filter metadata
to make it clear that it's Envoy-specific feature (here and everywhere else throughout this PR)?
fixes #288. Happy to adjust this to where it has the most value/clear use cases.