Return current path in callback origin#273
Return current path in callback origin#273grovertb wants to merge 3 commits intoexpressjs:masterfrom
Conversation
|
Hi @grovertb thank you for your PR. Ideally the change should be backward-compatible, though. But even then, can you not use mounting points to implement this? For example, have a |
|
@dougwilson We need to validate with the path because we have a service that consumes an endpoint that does not send origin, so we must allow based on the path to let it access without cors errors. I use callback(null, true) referring to the documentation example where true is passed. https://github.com/expressjs/cors#configuring-cors-asynchronously |
|
Hi @grovertb thank you. But I guess you still didn't answer my question: can you not use mounting points to implement this? For example, have a cors middleware that has origin: true mounted in your Express app to the paths you want any origin and then have your normal cors middleware mounted to the other paths? But even then, if there is no origin on the request, this CORS does not come in to play. It sounds like that is a non-browser web client. Maybe if you can provide all the details around your scenario and set up, I can help you use the existing method to vary on path this module has instead of adding a second method. Ideally we just want to have one way to do each type of thing. |
|
Hi @dougwilson, I have updated the example that I had sent, maybe that was causing confusion. We have a backend service that consumes directly from a microservice endpoint in which it does not have ORIGIN, so what we did is validate by the "path" and only that path ignores the cors validation. |
The change was added because some endpoints are called without origin, but we must allow them, so a wishList was added so that they can respond without a cors error.