Fix · Express / Node
Fix “CORS policy” on Express / Node
Never echo back the request Origin. Allow only a fixed list of your own origins, and only send credentials to those.
app.use(cors({ origin: ['https://yourapp.com'], credentials: true })); // never origin: true + credentials
Verify the fix
Re-run the CORS policy check after deploying. Test config changes in staging first and keep a rollback: a wrong header can break a site faster than a missing one.
Other stacks: nginx · Apache · Caddy · Cloudflare