Comments (5)
The cluster_xxx features in the route action are invoked during the route match. So the headers added in the HTTP filter, which is chosen after the route match, won't affect the behavior of cluster selection.
from envoy.
I don't try them myself but there may be some ways to satisfy your requirement:
- break down the adding header logic and cluster selection, so the cluster will be dynamically set via cluster-specific plugin without setting the header.
- find some way to clear route cache and update the cluster: https://www.envoyproxy.io/docs/envoy/latest/intro/life_of_a_request#http-filter-chain-processing. There may be some side-effect.
from envoy.
break down the adding header logic and cluster selection, so the cluster will be dynamically set via cluster-specific plugin without setting the header.
Yes I think this is the best way. If the ability to read all existing headers is added to the golang cluster_specifier
plugin then I can read the headers, decide on a cluster and then route to it - using only a single filter and within the route action section. This will remove the need to clear the route cache on every request.
I see now from the doc that you shared that a route is chosen before the HTTP filters are run, as stated here:
When decodeHeaders() is invoked on the router filter, the route selection is finalized and a cluster is picked. The HCM selects a route from its RouteConfiguration at the start of HTTP filter chain execution. This is referred to as the cached route. Filters may modify headers and cause a new route to be selected, by asking HCM to clear the route cache and requesting HCM to reevaluate the route selection.
But it's a bit confusing because in other places in the Envoy docs they strongly imply that the router filter will run after the HTTP filter chain, as per point 6 in the request flow section:
For each HTTP stream, an Downstream HTTP filter chain is created and runs. The request first passes through CustomFilter which may read and modify the request. The most important HTTP filter is the router filter which sits at the end of the HTTP filter chain. When decodeHeaders is invoked on the router filter, the route is selected and a cluster is picked.
from envoy.
6e3d574
HeaderMap.Set
won't clear route cache by default, it's first introduced in 1.30.0.
You need to clear route cache by using ClearRouteCache
instead.
from envoy.
Yep, api.FilterCallbackHandler.ClearRouteCache
enables the header change to take effect
Thank you for the information.
Once the capability to read the entire HeaderMap is added to the cluster_specifier
it will remove the need to clear the route cache
from envoy.
Related Issues (20)
- New CEL convenience function: random() HOT 8
- Newer release available `com_github_c_ares_c_ares`: v1.31.0 (current: cares-1_20_1) HOT 1
- Perf issue with c-ares DNS resolver HOT 10
- Control Weighted Cluster Weights via Runtime config
- Question about request_mirroring#disable_shadow_host_suffix_append HOT 2
- Garbled characters are displayed when setting cookie attribute HOT 3
- Qus: Does envoy support connecting to upstream Redis with TLS enabled? HOT 4
- Newer release available `com_github_zlib_ng_zlib_ng`: 2.1.7 (current: 2.0.7) HOT 1
- Newer release available `io_bazel_rules_go`: v0.48.1 (current: v0.46.0) HOT 1
- Newer release available `rules_python`: 0.33.2 (current: 0.32.2) HOT 1
- CONNECT-UDP in forwarding proxy mode resets stream and fails to send HTTP Datagrams HOT 7
- Regarding use of envoy api along with envoy api dependencies HOT 13
- Newer release available `com_github_wasmtime`: v22.0.0 (current: v9.0.3)
- ext_proc: should return 504 on timeout error HOT 1
- Does envoy supports configuring upstream application layer protocol? HOT 4
- Clean up Stats header import of MemoryTest HOT 1
- Newer release available `aspect_bazel_lib`: v2.7.8 (current: v2.7.7) HOT 1
- Newer release available `com_github_bufbuild_buf`: v1.34.0 (current: v1.32.2)
- Newer release available `com_github_datadog_dd_trace_cpp`: v0.2.2 (current: v0.2.1)
- Newer release available `io_opentelemetry_cpp`: v1.16.0 (current: v1.14.2) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from envoy.