Quantcast
Channel: Plesk Forum
Viewing all articles
Browse latest Browse all 45788

IIS "Cors" configuration problem for Node.js backend

$
0
0
I have a node.js backend, and in my server.js file I have this:

const app = express();
app.use((req, res, next) => {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader(
"Access-Control-Allow-Methods",
"OPTIONS, GET, POST, PUT, PATCH, DELETE"
);
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
next();
});


It is working correctly in the Localhost, but after uploading to the server, it gives this Cors error...

IIS "Cors" configuration problem for Node.js backend

Viewing all articles
Browse latest Browse all 45788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>