I would recommend the cors-module: https://www.npmjs.org/package/cors
It does this kind of stuff for you – check the “Configuring CORS w/ Dynamic Origin”-Section
I would recommend the cors-module: https://www.npmjs.org/package/cors
It does this kind of stuff for you – check the “Configuring CORS w/ Dynamic Origin”-Section