Streaming grpc服务器端流传输失败(带有subsequest CORS错误)
我能够使用GRPCWeb实现一元呼叫,但服务器端流式处理无法按预期工作。 第一次打开页面时,将调用CreateStream并按预期工作。网络选项卡如下所示:(有飞行前响应,但屏幕截图中未显示) 这是CreateStream 200详细信息: 大约1分钟30-40秒后,将出现以下错误: 发生该错误时,将有另一个挂起的CreateStream: 我的特使yaml看起来像这样:Streaming grpc服务器端流传输失败(带有subsequest CORS错误),streaming,grpc,cloudflare,deadlines,Streaming,Grpc,Cloudflare,Deadlines,我能够使用GRPCWeb实现一元呼叫,但服务器端流式处理无法按预期工作。 第一次打开页面时,将调用CreateStream并按预期工作。网络选项卡如下所示:(有飞行前响应,但屏幕截图中未显示) 这是CreateStream 200详细信息: 大约1分钟30-40秒后,将出现以下错误: 发生该错误时,将有另一个挂起的CreateStream: 我的特使yaml看起来像这样: static_resources: listeners: - name: listener_0 ad
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 30800 }
filter_chains:
- filters:
- name: envoy.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
stream_idle_timeout: 0s
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match: { prefix: "/auth." }
route:
cluster: auth_service
max_grpc_timeout: 0s
- match: { prefix: "/name_of_service." }
route:
cluster: stream_service
timeout: 0s
max_grpc_timeout: 0s
cors:
allow_origin_string_match:
- prefix: "*"
allow_methods: GET, PUT, DELETE, POST, OPTIONS
allow_headers: access-control-allow-origin,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,access-token,token, authorize-token,x-site-type,x-origin,x-pin-token,grpc-timeout
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
此错误总是每1分钟30/40秒发生一次。这意味着如果我不关闭页面,控制台中的红色错误消息将非常多。
我也试过在客户方面设置截止日期,但没有用。如何修复此CORS错误?我没有看cloudflare,因为idk需要看什么,而且如果cloudflare是个问题,为什么一元调用和第一个服务器流式调用可以工作?
谢谢根本问题不是CORS错误,而是其他一些问题—某些故障会阻止服务器发送/完成浏览器期望的响应。当您检查响应来自的服务器的服务器日志时,您发现那里记录了哪些相关消息?@sideshowbarker我检查了我的grpc服务和特使日志,没有错误。。。grpc服务也可以在本地运行,并且bloomrpc中没有错误