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

[OPTIONS] Restrict preflight for defined origins (clients) only #6

Open
and-ratajski opened this issue Feb 24, 2023 · 0 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@and-ratajski
Copy link
Collaborator

Allow only selected origins (clients) to pass their OPTIONS requests through cx-treafik-forward-auth. For the time being, if the AUTH_ALLOW_UNSEC_OPTIONS is set to true all OPTIONS requests are accepted.

Ref:

* TODO: Restrict preflight for defined origins (clients) only.
*/
if (AUTH_ALLOW_UNSEC_OPTIONS) {
app.use(
async (req: Request, res: Response, next: NextFunction): Promise<void> => {
if (req.headers["x-forwarded-method"] === "OPTIONS") {
logger.debug(
`Detected OPTIONS request from ${req.url} - passing through!`
);
res.sendStatus(200);
return;
} else {
next();
}
}
);
}

@and-ratajski and-ratajski self-assigned this Feb 24, 2023
@and-ratajski and-ratajski added the enhancement New feature or request label Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant