0

Chrome has a Cookie flag Priority which prioritises which Cookies will be deleted first (lower priority)..

e.g.

Set-Cookie: GAPS=1:ZYBtVMzURzU2umKMxZThJ2lVPxy3Hg:SvHhlG2k1Vy5pnA0;Path=/;Expires=Wed, 04-Nov-2015 20:44:37 GMT;Secure;HttpOnly;Priority=High

I'd like to set this value from express, but I can't see anyway I'd do that (docs).

Can someone point me in the right direction? (Do I need to set the header myself?)

References:

3

1 Answer 1

1

So, I ended up just using the cookie library internally used by express...

const cookie = require('cookie')

// ... inside route ...

let setCookie = cookie.serialize('name', value, {
  expires: new Date(9999, 11, 31),
  path: '/',
  httpOnly: true,
  secure: true,
  domain: yourCookieDomain
})
setCookie += '; Priority=High'
res.append('Set-Cookie', setCookie)

Gives...

set-cookie: name=value; Domain=foobar.com; Path=/; Expires=Fri, 31 Dec 9999 00:00:00 GMT; HttpOnly; Secure; Priority=High

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.