envoyproxy / envoy-filter-example

Example of consuming Envoy and adding a custom filter
333 stars 206 forks source link

Header added in custom filter - can it be used in routing decision? #154

Closed ghost closed 2 years ago

ghost commented 2 years ago

I supposed the custom header added by custom filter (C++) can be used for match header while routing to clusters. Do we need extra configuration to do? Below “custom.filter” basically adds a header “http-group” with value “r-server”, but somehow it’s not matching. But if i add the same header in the client request, it works though. Or is it something to do with static routing? Do i need to use RDS? Please any input will be welcome!

ghost commented 2 years ago

Found it - we need to use callbacks_->clearRouteCache(); But be careful to use this, it seems there is a performance penalty on this. https://github.com/envoyproxy/envoy/issues/5914