I want Express server side redirect angular page.
I run express at localhost:3000
angular at localhost:4200
when Express redirect to Angular localhost:4200
I always get error
Failed to load http://localhost:4200/login: Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.
how to let angular accept cors response?
Install cors package in your server-side express code
npm install --save cors
Use that in your server.js or app.js file where you implement all logic of express.js
const cors = require('cors');
app.use(cors());
It enables the cross-origin functionality, where you can access the request from another domain
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With