Skip to content

Always set CORS headers#434

Merged
sleipnir merged 2 commits intoelixir-grpc:masterfrom
aseigo:bug/work-without-preflights
Aug 24, 2025
Merged

Always set CORS headers#434
sleipnir merged 2 commits intoelixir-grpc:masterfrom
aseigo:bug/work-without-preflights

Conversation

@aseigo
Copy link
Contributor

@aseigo aseigo commented Aug 24, 2025

We have discovered that not all gRPC-web sessions advertise CORS in their headers, but they are still limited by CORS by the browser itself. This causes those non-advertising gRPC requests to fail unexpectedly. It is possible to trigger this with the official upstream JS library, even, depending on the configuration.

So this PR cuases the interceptor to always attempt to set CORS headers. In practice, this is still setting the headers just as often, as GRPC sessions that do advertise CORS in the request headers do so consistently, so the performance impact is essentially nil.

aseigo added 2 commits August 24, 2025 11:47
In practice, this is still setting the headers just as often, as
GRPC sessions that do advertise CORS in the request headers do so
consistently, while those that do not are still limited by CORS by
the browser policy.
@sleipnir sleipnir merged commit 2003255 into elixir-grpc:master Aug 24, 2025
7 checks passed
@sleipnir
Copy link
Collaborator

Tks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants