You can configure CORS to be more specific about which origins are allowed and other settings. For example:
const corsOptions = {
origin: 'http://example.com', // Allow only requests from this origin
methods: 'GET,POST', // Allow only GET and POST methods
allowedHeaders: 'Content-Type,Authorization', // Allow only these headers
};
app.use(cors(corsOptions));
Leave a Reply