-
Notifications
You must be signed in to change notification settings - Fork 463
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
Cors origin RegExp issues #292
Comments
I am not sure if that pr could fix the issue but I will take a look at test that locally to see #276 |
@dougwilson any thoughts on that behaviour? |
Hello, and sorry you are having trouble. From reading your issue, it sounds like you debugged through and saw that your regexp matched and the module set the expected response headers, but yet cors still failed, is that correct? If so, that sounds strange, and I'm not sure what to make of it, exactly. I can help debug your issue too, but I need you to provide a minimal reproducable example that I can run and get the same issue so I can debug it. You're always welcome to submit a patch directly as well. |
Thank you for your answer, yes this is exactly the flow. The thing is that I tried to check everywhere in the middleware to see if something went wrong and did not find anything. I ve linked the pr i ve made in our repo but the best way to reproduce it might be to just test to use a regexp such as |
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 :) |
another info is that evaluating |
Indeed, the issue is link to the usage of flag which can give random behaviour to the mutation of the underlying properties that RegExp use under the hood. Just done another test and now it is working. |
Which flag are you referring to? Neither regexp you posted |
Sorry missed it but I was using |
Hey 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 regexpBut 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?
The text was updated successfully, but these errors were encountered: