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

Add CORS headers to the responses for the client #77

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

AbdulrhmanGoni
Copy link
Owner

Create crosHeadersSetters function which takes the headers object of responses and sets the required CORS headers for the client(browser) be able to receive the responses confidently without blocking.

Use crosHeadersSetters function in src/router/serveRequests.ts file to set CORS headers for the responses to the preflight requests that are sent by the browsers to determine if it is safe to fetch this resource, And for the normal responses after handling the requests.

Create `crosHeadersSetters` function which takes the headers
object of responses and sets the required `CORS` headers for
the client(browser) be able to receive the responses confidently
without blocking.

Use `crosHeadersSetters` function in `src/router/serveRequests.ts`
file to set CORS headers for the responses to the preflight requests
that are sent by the browsers to determine if it is safe to fetch this
resource, And for the normal responses after handling the requests.
@AbdulrhmanGoni AbdulrhmanGoni changed the title Add CORS headers to the responses for the client due to CORS policy Add CORS headers to the responses for the client Nov 8, 2024
@AbdulrhmanGoni AbdulrhmanGoni merged commit 766d794 into main Nov 8, 2024
2 checks passed
@AbdulrhmanGoni AbdulrhmanGoni deleted the hotfix/cors-error-in-the-client branch November 8, 2024 14:26
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.

1 participant