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

fix: Expand CORS bypass for /clusters/:id/calls endpoint #415

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions control-plane/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ app.register(initServer().plugin(router.router), parent => {

const allowedOrigins = [env.APP_ORIGIN];

const corsBypassRegex = new RegExp(/\/clusters\/.*\/runs/);
const corsBypassRegexes = [
new RegExp(/\/clusters\/.*\/runs/),
new RegExp(/\/workflows\/.*\/calls/),
];

app.register(cors, {
delegator: (req, callback) => {
Expand All @@ -46,7 +49,7 @@ app.register(cors, {
return;
}

if (corsBypassRegex.test(req.url ?? "")) {
if (corsBypassRegexes.some(regex => regex.test(req.url ?? ""))) {
callback(null, {
origin: true,
});
Expand Down
Loading