-
Notifications
You must be signed in to change notification settings - Fork 461
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
Incorrect response when option origin is true and requestOrigin is undefined #295
Comments
Sorry, I may have misread your issue. I will need to check it out. Can you please include complete code and complete way to reproduce? I was not sure how to assemble the procided code snipplets into a running app to reproduce your issue. Ideally please provide the following so I can take a look:
Thank you and sorry about the initial response! |
Thank you for the consideration. I will have to collect more data myself because I get these reports from users but cannot reproduce myself. However this seems to be the source of the problem; a missing I will do my best to provide you with either a reproducible example, or a withdrawal of this issue. |
For an app requesting data using the relative URL
/api/data
using this method :And an API route handled this way :
With the
apiMiddleware
defined this way :The
origin
function will receiveundefined
as request origin, so even if the returned value istrue
(i.e. accept the request), the resposne will be handled like this :cors/lib/index.js
Lines 58 to 67 in f038e77
The line 62 will actually resolve like this :
Which will not send the
Access-Control-Allow-Origin
header to the client.A fix could be to send
"*"
as default origin :The text was updated successfully, but these errors were encountered: