Search code examples
envoyproxy

How to get domain from Envoy by Lua


I'd like to route request by different domains. I've read https://www.envoyproxy.io/docs/envoy/v1.12.2/configuration/http/http_filters/lua_filter, but I can not find any mehod can do that. Is there anyway to get domain from Envoy by Lua?

Thanks


Solution

  • To get the domain from the request using Lua you can use the :host special header. However, to route by domain what you may want is to use virtual hosts in RDS where you can specify a set of routes that correspond to a set of domains, and Envoy will handle partitioning the traffic based on domain.

    https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-msg-config-route-v3-virtualhost