mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
added new requirements for lessons and units
Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -28,8 +28,19 @@
|
||||
const csurf = require('csurf');
|
||||
const R = require('../utils/response.util');
|
||||
|
||||
/** csurf instance — stores token in a signed cookie */
|
||||
const csrfProtection = csurf({ cookie: { httpOnly: true, sameSite: 'strict' } });
|
||||
/**
|
||||
* csurf instance — stores token in a signed cookie.
|
||||
* sameSite:'none' (not 'strict') in production — frontend (Vercel) and this
|
||||
* API (Render) are cross-site, so 'strict' drops the cookie on every
|
||||
* fetch/XHR call. 'none' requires secure:true, set alongside it below.
|
||||
*/
|
||||
const csrfProtection = csurf({
|
||||
cookie: {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
sameSite: process.env.NODE_ENV === 'production' ? 'none' : 'lax',
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* GET /api/csrf-token
|
||||
|
||||
Reference in New Issue
Block a user