Answer the question
In order to leave comments, you need to log in
Trouble with CORS?
Cors is configured on the server - get requests go through, with a post request an error
Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response
'Access-Control-Allow-Origin': '*'
Answer the question
In order to leave comments, you need to log in
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header set Access-Control-Max-Age "1000"
Header set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, x-access-token"
const cors = require('cors');
const app = express();
app.use(cors());
const app = express();
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET, HEAD, OPTIONS, POST, PUT');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
next();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question