I have made an application with node js and react,Im hosting them on namecheap and the server side on node js is node.kutiza.com,the client side is finanu.kutiza.com,when im requesting on node.kutiza.com im getting an error saying.
Access to XMLHttpRequest at 'http://node.kutiza.com/krankenkasse/regions' from origin 'http://finanu.kutiza.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
var express = require('express');
var cors = require('cors');
var krankenkasse_calculator = require('./routes/krankenkasse.js');
const app = express()
app.use(cors({ origin: true, credentials: true }));
const port = 5000
app.all('/', function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
next();
});
app.use('/krankenkasse', krankenkasse_calculator);
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
NOTE : On localhost everything is working fine