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

Update index.js #339

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update index.js #339

wants to merge 1 commit into from

Conversation

M-zhar
Copy link

@M-zhar M-zhar commented Nov 28, 2024

Setting Vary: Origin Header for All Requests:

The res.setHeader('Vary', 'Origin') line ensures that every response includes the Vary: Origin header, regardless of whether it's a CORS or non-CORS request.

//CORS Middleware for Requests with Origin:
The dynamic cors middleware is applied only if the originCallback function validates the origin.

//Non-CORS Requests:
For requests without the Origin header, the middleware still sets the Vary: Origin header and proceeds without invoking the cors middleware.

Setting Vary: Origin Header for All Requests:

The res.setHeader('Vary', 'Origin') line ensures that every response includes the Vary: Origin header, regardless of whether it's a CORS or non-CORS request.

//CORS Middleware for Requests with Origin:
The dynamic cors middleware is applied only if the originCallback function validates the origin.


//Non-CORS Requests:
For requests without the Origin header, the middleware still sets the Vary: Origin header and proceeds without invoking the cors middleware.
@M-zhar
Copy link
Author

M-zhar commented Nov 28, 2024

Differentiating in cors-request and non-cors request

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