【发布时间】:2020-11-26 05:10:10
【问题描述】:
我正在尝试设置 Envoy 以将 "/account" 路由到 gRPC 服务。如果我将路由前缀设置为"/",它工作正常,但如果我引入"/account",它会中断。我试过prefix_rewrite:"/",但没有帮助。
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 } }]
点击localhost:3000/account 会导致:
{
"error": "14 UNAVAILABLE: DNS resolution failed"
}
感谢您的宝贵时间。我知道它很有价值!
【问题讨论】:
标签: proxy grpc envoyproxy