Cors origin RegExp issues
See original GitHub issueHey there, first of all thank you for this middleware.
I am having some issues using the regexp with the origin using the cors middleware.
When I set the value to be /http:\\/\\/localhost:[0-9]+$/
the regexp is properly constructed. Putting some breakpoints in the lib I can see that the origin is allowed using the regexp
But for un unknown reason after the header are set properly, I still get a cors issue
Funny enough, the cors error happen only on the auth route as you can see here
The cors are setup on app using app.use and then later on the auth routes are added to a Router() and the router is consumed by app.use
Would you have any idea what is happening?
Issue Analytics
- State:
- Created 10 months ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Using a regular expression with CORS - regex - Stack Overflow
One way to do this is to first get the value of the Origin header from the request (this varies from server to...
Read more >Support regular expressions in CORS origins configuration
Providing regex support when specifying the allowed origins in CORS configuration would be extremely helpful. Currently, there is no documented ...
Read more >Match CORS 'allowedOrigins' with regular expression in ...
A regular expression value must match the entire value of the Origin header in the HTTP request for it to be considered a...
Read more >Rack CORS origins via ENV var and Regex
CORS errors are common issues when you have an API-only Rails Application with a separate front end. The basic configuration looks like: Rails....
Read more >Regular Expression for CORS configuration - Mattermost Forum
Hello! Does anyone knows, can I set regular expression for CORS config, something like (https?:\/\/localhost:[0-9]{1,5})|(https?:\/\/([^\.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yea, I tested the regexp locally and there are tests in our test suite as well that are working fine. So something different between the environments and code or something and not sure how to determine that since what i tried before responding works and the test suite verifies thay regexp matching works. I believe absolutely you are having an issue, but just don’t know the cause and how to reproduce it to debug, which is why i asked for one if you’re interested in having me debug 😃
Sorry missed it but I was using
/g
flag among other tests and it was certainly the culprit.