CORS Origins Regex Parsing? #3709
Priyansh4444
started this conversation in
Ideas
Replies: 1 comment
-
I don't think strings should implicitly be parsed as regexes. I think a better approach would be to allow RegExp objects alongside strings as input. E.G: Though you could do an equivalent with the callback: cors({
origin: (origin) => {
if (/localhost:\d*/.test(origin)) {
return origin
}
return "https://public.website"
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When CORS origins takes a string[], does it do regex parsing to found the allowed origins? and if it doesn't should it?
I was mentoring for a hackathon, and he was getting CORS errors, since the list had [ '*' ] as one of them, so would it be possible to make that happen?
I'd love to contribute and spin this up if this was an intended feature, but i am unsure if allowing regex in the list of strings is supposed to be allowed!
Beta Was this translation helpful? Give feedback.
All reactions