-
Notifications
You must be signed in to change notification settings - Fork 690
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
Support specific dynamic request headers #3234
Comments
See main...erwbgy:dynamic-headers for proposed changes. |
Hey @erwbgy yup I think that makes sense to me and would work. Also, your design leaves the door open to allow full customization later on. Will be curious what others think as well about this. |
Agreed with @stevesloka, looks like your approach is simple enough, works, and provides value and as you note Envoy and the change to contour avoid some of the more convoluted scenarios. Might be worth examining if |
Good catch about %START_TIME% @sunjayBhatia, I hadn't noticed that an optional format string could be passed. I think you're right that it should be omitted as special casing it would add unnecessary complication right now. The %REQ(header)% special case at least has a user request for this functionality. Ack about the additional test cases required. |
I'll take a look at the PR now, but overall, I think this design is good. I really appreciate that you've been cautious about the NACK problem #1176 (which the Envoy message in your OP would indicate we would run into). Thanks for the great design, and the PR! |
Thanks for the awesome PR @erwbgy Think we can get this in 1.12? @youngnick |
Envoy supports adding dynamic values to request and response headers like %HOSTNAME% but currently the % is escaped over concerns about sending invalid data to Envoy which will be rejected and cause failures. These changes allow a specific set of known good Envoy dynamic headers to pass through unescaped and continue escaping the % for anything else. Closes #3234. Signed-off-by: Keith Burdis <keith.burdis@gs.com>
Add support for %CONTOUR_NAMESPACE%, %CONTOUR_SERVICE_NAME% and %CONTOUR_SERVICE_PORT% dynamic variables and have these expanded like Envoy dynamic variables are in projectcontour#3234. (The CONTOUR_ prefix is used so that there is no possibility of a clash with a future Envoy dynamic variable.) If any of these variables are used where they can't be expanded then they are just passed through literally. For example if %CONTOUR_SERVICE_NAME% is used at the route level then it is not expanded and becomes %%CONTOUR_SERVICE_NAME%% when passed to Envoy. This avoids any Envoy configuration errors due to bad dynamic variables. Signed-off-by: Keith Burdis <keith.burdis@gs.com>
Add support for %CONTOUR_NAMESPACE%, %CONTOUR_SERVICE_NAME% and %CONTOUR_SERVICE_PORT% dynamic variables and have these expanded like Envoy dynamic variables are in projectcontour#3234. (The CONTOUR_ prefix is used so that there is no possibility of a clash with a future Envoy dynamic variable.) If any of these variables are used where they can't be expanded then they are just passed through literally. For example if %CONTOUR_SERVICE_NAME% is used at the route level then it is not expanded and becomes %%CONTOUR_SERVICE_NAME%% when passed to Envoy. This avoids any Envoy configuration errors due to bad dynamic variables. Signed-off-by: Keith Burdis <keith.burdis@gs.com>
Add support for %CONTOUR_NAMESPACE%, %CONTOUR_SERVICE_NAME% and %CONTOUR_SERVICE_PORT% dynamic variables and have these expanded like Envoy dynamic variables are in projectcontour#3234. (The CONTOUR_ prefix is used so that there is no possibility of a clash with a future Envoy dynamic variable.) If any of these variables are used where they can't be expanded then they are just passed through literally. For example if %CONTOUR_SERVICE_NAME% is used at the route level then it is not expanded and becomes %%CONTOUR_SERVICE_NAME%% when passed to Envoy. This avoids any Envoy configuration errors due to bad dynamic variables. Signed-off-by: Keith Burdis <keith.burdis@gs.com>
Add support for %CONTOUR_NAMESPACE%, %CONTOUR_SERVICE_NAME% and %CONTOUR_SERVICE_PORT% dynamic variables and have these expanded like Envoy dynamic variables are in projectcontour#3234. (The CONTOUR_ prefix is used so that there is no possibility of a clash with a future Envoy dynamic variable.) If any of these variables are used where they can't be expanded then they are just passed through literally. For example if %CONTOUR_SERVICE_NAME% is used at the route level then it is not expanded and becomes %%CONTOUR_SERVICE_NAME%% when passed to Envoy. This avoids any Envoy configuration errors due to bad dynamic variables. Signed-off-by: Keith Burdis <keith.burdis@gs.com>
Add support for %CONTOUR_NAMESPACE%, %CONTOUR_SERVICE_NAME% and %CONTOUR_SERVICE_PORT% dynamic variables and have these expanded like Envoy dynamic variables are in #3234. (The CONTOUR_ prefix is used so that there is no possibility of a clash with a future Envoy dynamic variable.) If any of these variables are used where they can't be expanded then they are just passed through literally. For example if %CONTOUR_SERVICE_NAME% is used at the route level then it is not expanded and becomes %%CONTOUR_SERVICE_NAME%% when passed to Envoy. This avoids any Envoy configuration errors due to bad dynamic variables. Signed-off-by: Keith Burdis <keith.burdis@gs.com>
Please describe the problem you have
From https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/headers#custom-request-response-headers:
I would like to use these dynamic values to set request headers - for example:
but currently the % is escaped so the result is a literal %HOSTNAME% rather than the expected dynamic value.
There have also been other requests like #2516 to set header values based on other header values.
There are legitimate concerns about sending invalid data to Envoy (see #1176 and #2569) as invalid custom headers cause route configuration failures - for example testing using a patched contour that allows %UNKNOWN% through:
results in:
The proposal is to only allow a specific set of known good Envoy dynamic headers to pass through unescaped and continue escaping the % for anything else:
Notes:
I think this provides useful functionality while still ensuring that bad config is not sent to Envoy.
Would you be open to a pull request that implements this?
The text was updated successfully, but these errors were encountered: