Reputation: 11285
I'm trying to setup Envoy to route "/account"
to a gRPC service. It works fine if I set the route prefix to "/"
but if I introduce "/account"
, it breaks. I've tried prefix_rewrite:"/"
but that didn't help.
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 3000 }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: auto
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match: { prefix: "/account/" }
route: {cluster: account_service, prefix_rewrite: "/" }
- match: { prefix: "/account" }
route: { cluster: account_service, prefix_rewrite: "/"}
http_filters:
- name: envoy.filters.http.grpc_web
- name: envoy.filters.http.router
clusters:
- name: account_service
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
hosts: [{ socket_address: { address: account, port_value: 3400 } }]
Hitting localhost:3000/account
results in:
{
"error": "14 UNAVAILABLE: DNS resolution failed"
}
Thank you for your time. I know it is valuable!
Upvotes: 2
Views: 2711
Reputation: 828
prefix_rewrite won't work since it will route localhost:3000/account to account_service:3400/. Simply in your scenario, this should work. This should route localhost:3000/account to account_service:3400/account
- match: { prefix: "/account/" }
route: {cluster: account_service}
Upvotes: 1