CORS issue for server-side streaming
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 802
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 5
Description
I am able to implement unary calls using grpc-web but server side streaming doesn't work as expected. When first open the page, CreateStream is called and works as expected. the network tab looks like this: (there's preflight response but not shown in the screenshot)

This is CreateStream 200 detail:

After around 1 minutes 30-40 seconds, there will be this error:

There will be another pending CreateStream when that error occured:

My envoy.yaml looks like this:
```
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
```
This error always occur every 1 minute 30/40 seconds. That means the red error messages in the console will be a lot if I don't close the page. I have also tried setting deadline on customer side but its no use. How to fix this CORS error? I haven't look at the cloudflare because idk what to look at, and also if cloudflare is the problem why do unary calls and the first server streaming call works? Thanks
Contributor guide
Assessment
This issue has not been assessed yet.