Answer the question
In order to leave comments, you need to log in
Why does the server return 500 status after setting csrf?
index.js
// Middleware
app.use(express.json())
app.use(cookieParser())
app.use(cors({
origin: 'http://localhost:8081',
credentials: true,
methods: ['GET', 'POST', 'PUT', 'DELETE']
}))
app.use(csrf({cookie: {httpOnly: true} }))
app.use(helmet.frameguard({ action: 'SAMEORIGIN' }))
app.use(safetyMiddleware)
app.use('/api', router)
// Возможные ошибки с IOS
app.use(errorMiddleware)
module.exports = function (req, res, next) {
res.set("Content-Security-Policy", "default-src 'self'")
res.set("X-XSS-Protection", "1; mode=block")
res.set("X-Content-Type-Options", "nosniff")
// res.set("XSRF-Token", req.csrfToken())
next()
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question