summaryrefslogtreecommitdiff
path: root/bucky/app/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'bucky/app/index.js')
-rw-r--r--bucky/app/index.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/bucky/app/index.js b/bucky/app/index.js
index 248679a..b600935 100644
--- a/bucky/app/index.js
+++ b/bucky/app/index.js
@@ -25,12 +25,16 @@ site.init = function(){
app.set('port', process.env.PORT || 5000)
app.use(favicon(__dirname + '../../../public/favicon.ico'))
app.use(bodyParser.json())
- app.use(cookieParser());
+ app.use(cookieParser())
app.use(session({
secret: 'argonauts',
proxy: true,
key: 'bucky.sid',
- cookie: {secure: true, domain: '.' + process.env.HOST_NAME, maxAge: 43200000000 },
+ cookie: {
+ secure: process.env.NODE_ENV === 'production',
+ domain: '.' + process.env.HOST_NAME,
+ maxAge: 43200000000,
+ },
store: new MongoStore({
url: 'mongodb://localhost/buckySessionDb'
// type: 'mongodb',
@@ -43,7 +47,11 @@ site.init = function(){
resave: true,
saveUninitialized: false,
}))
- app.use(csurf({ cookie: true }))
+
+ app.use(csurf({
+ cookie: true,
+ value: (req) => req.headers['csrf-token'],
+ }))
app.disable('x-powered-by')
app.use(express.query())