We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
按照上一篇的配置,如果使用流模式我们会发现一个问题,如果推送服务挂了再恢复,我们的浏览器是无法再收到推送消息的,直到浏览器刷新或者代理服务重启才行。
目前没有发现可以通过 grpc-web 代码方式解决上面的问题,在官网发现了路由重试策略的介绍,我们可以通过 retry_on配置重试的条件,通过num_retries配置重试的次数。
retry_on
num_retries
修改如下配置:
# 省略 route: cluster: greeter_service timeout: 0s retry_policy: #retry_on: connect-failure,refused-stream,unavailable,cancelled,retriable-status-codes retry_on: 5xx num_retries: 10 max_stream_duration: grpc_timeout_header_max: 0s # 省略
完整配置如下
admin: access_log_path: /tmp/admin_access.log address: socket_address: { address: 0.0.0.0, port_value: 9902 } 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 timeout: 0s retry_policy: #retry_on: connect-failure,refused-stream,unavailable,cancelled,retriable-status-codes retry_on: 5xx num_retries: 10 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 # win/mac hosts: Use address: host.docker.internal instead of address: localhost in the line below load_assignment: cluster_name: cluster_0 endpoints: - lb_endpoints: - endpoint: address: socket_address: address: 0.0.0.0 # 此处换成你需要代理的 grpc 服务地址 port_value: 8090
The text was updated successfully, but these errors were encountered:
No branches or pull requests
前言
按照上一篇的配置,如果使用流模式我们会发现一个问题,如果推送服务挂了再恢复,我们的浏览器是无法再收到推送消息的,直到浏览器刷新或者代理服务重启才行。
重试策略
目前没有发现可以通过 grpc-web 代码方式解决上面的问题,在官网发现了路由重试策略的介绍,我们可以通过
retry_on
配置重试的条件,通过num_retries
配置重试的次数。修改如下配置:
完整配置如下
The text was updated successfully, but these errors were encountered: