I developed an application with NextJs then built it. I run it on node server using 'npm run start'. it works fine on localhost on port 80, but my server does not accept any request from outside neither by domain name or IP address. how should I configure application or nodejs to accept all request ?
CodePudding user response:
You need to allow CORS
res.header('Access-Control-Allow-Origin', '*');
CodePudding user response:
Try to this cors
npm module - https://www.npmjs.com/package/cors
var cors = require('cors');
var app = express();
app.use(cors());
It provides many features to configure cors setting including domain whitelisting, enabling cors for specific apis and many more.