Is it possible to write an envoy plugin that would resolve request destination at runtime?
Problem I'm trying to solve:
What is the easiest way to to have envoy route requests to correct destination?
I ended up using a combination of xDS protocol and external auth endpoint.
envoy.filters.http.ext_authz
filter is added so that Envoy would make a gRPC request for each incoming HTTP request.When HTTP request arrives, Envoy has to make a routing decision immediately. At this point is too late to add new routes and cluster definitions so following trick is used:
ext_authz
endpoint. The service providing this endpoint blocks the auth request while it figures out where it should be routed.DeniedHttpResponse
that contains 302
redirect to the same URL.