Skip to content

Commit 9dc3794

Browse files
Added the cookie domain optipn in the /api/csrf-cookie route
Changes modified: web/routes/index.js modified: web/web.js
1 parent 98fefb4 commit 9dc3794

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

web/routes/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Route.get('/', async (_req, res) => {
1515
* GET and set the csrf cookie
1616
*/
1717
Route.get('/csrf-cookie', (req, res) => {
18-
res.cookie('XSRF-TOKEN', req.csrfToken())
18+
res.cookie('XSRF-TOKEN', req.csrfToken(), {domain: process.env.COOKIE_DOMAIN || 'localhost'})
1919
res.status(204).json('')
2020
})
2121

web/web.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ web.use(csrf({
2828
cookie: {
2929
sameSite: 'lax',
3030
secure: false,
31-
domain: process.env.COOKIE_DOMAIN | 'localhost'
31+
domain: process.env.COOKIE_DOMAIN || 'localhost'
3232
},
3333
ignoreMethods: process.env.NODE_ENV === 'development' ? ['POST', 'PUT', 'DELETE', 'GET', 'OPTIONS'] : ['GET', 'HEAD', 'OPTIONS'],
3434
sessionKey: 'de'

0 commit comments

Comments
 (0)