[英]Envoy proxy: 503 Service Unavailable
Client ( nuxt
) is up on http://localhost:3000
and the client sends requests to http://localhost:8080
.客户端( nuxt
)在http://localhost:3000
上启动,客户端向http://localhost:8080
发送请求。
Server ( django
) is running on 0.0.0.0:50051
.服务器( django
)在0.0.0.0:50051
上运行。
Also docker
is up docker
也涨了
78496fef541f 5f9773709483 "/docker-entrypoint.…" 29 minutes
ago Up 29 minutes 0.0.0.0:8080->8080/tcp, :::8080-8080/tcp,
10000/tcp envoy
envoy.yaml
Configurations: envoy.yaml
配置: I configured the envoy.yaml
file as follows:我配置了envoy.yaml
文件如下:
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 8080 }
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: "/" }
route:
cluster: greeter_service
max_stream_duration:
grpc_timeout_header_max: 0s
cors:
allow_origin_string_match:
- prefix: "*"
allow_methods: GET, PUT, DELETE, POST, OPTIONS
allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout
max_age: "1728000"
expose_headers: custom-header-1,grpc-status,grpc-message
http_filters:
- name: envoy.filters.http.grpc_web
- name: envoy.filters.http.cors
- name: envoy.filters.http.router
clusters:
- name: greeter_service
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
load_assignment:
cluster_name: cluster_0
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 0.0.0.0
port_value: 50051
But the following error occurs and, as it seems, the requests do not reach the Django 0.0.0.0:50051
server.但是发生了以下错误,并且看起来,请求没有到达 Django 0.0.0.0:50051
服务器。
503 Service Unavailable 503服务不可用
grpc-message: upstream connect error or disconnect/reset before headers. grpc-message:上游连接错误或在标头之前断开/重置。 reset reason: connection failure, transport failure reason: delayed connect error: 111重置原因:连接失败,传输失败原因:延迟连接错误:111
I needed a proxy to receive requests from the server.我需要一个代理来接收来自服务器的请求。 So I used envoy proxy .所以我使用了特使代理。 In this way, nginx received the request from the browser and then sent it to a port (for example 5000).这样, nginx就收到了来自浏览器的请求,然后发送到一个端口(例如5000)。 On the other hand, envoy
listens to port 5000 and then sends the request to the server running on port 50051.另一方面, envoy
监听 5000 端口,然后将请求发送到运行在 50051 端口上的服务器。
This is how I designed the tracking of a gRPC
connection.这就是我设计gRPC
连接跟踪的方式。
I have encountered the same error.我遇到了同样的错误。 Here are my condition:这是我的条件:
Im starting all on local environment.我从本地环境开始。
Based on this example about configuring the envoy proxy that refer to this issue , I change the address on envoy proxy to host.docker.internal
on envoy.yaml.基于this example关于配置参考this issue的envoy代理,我将envoy代理上的地址更改为host.docker.internal
on envoy.yaml。
Just refer to this section, if you want to try:如果您想尝试,请参阅本节:
clusters:
- name: backend_service
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
load_assignment:
cluster_name: cluster_0
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: host.docker.internal // i change it, before was 0.0.0.0
port_value: 9090
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.