Skip to content
New issue

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

handle cors preflight without auth #111

Merged
merged 1 commit into from
Apr 10, 2024
Merged

Conversation

bolyachevets
Copy link
Collaborator

@bolyachevets bolyachevets commented Apr 9, 2024

Description of changes: Currently dashboard view of safe list is not working, e.g. see bcgov/entity#20463

This is a regression due to moving notify-api and ui to different domains.

Cors preflight mechanism kicks in because of domain difference, and is consequently failing because the endpoint is expecting auth token (while preflight does not supply auth tokens by design).

Screenshot 2024-04-09 at 10 26 55 AM

Failing preflight request causes the original request to fail

See (see https://cloud.google.com/functions/docs/writing/write-http-functions#cors-limitations):

"CORS limitations
For preflighted cross-origin requests, preflight OPTIONS requests are sent without an Authorization header, so they will be rejected on all HTTP functions that require authentication. Because the preflight requests fail, the main requests will also fail. To work around this limitation, use one of the following options:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the bcrs-entities-create-ui license (Apache 2.0).

@bolyachevets bolyachevets merged commit 7d0a59a into main Apr 10, 2024
2 of 3 checks passed
@bolyachevets bolyachevets deleted the handle-cors-preflight branch April 10, 2024 15:37
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