Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookie Writer: Allow customization of expiration date #22422

Closed
zhouyx opened this issue May 22, 2019 · 3 comments
Closed

Cookie Writer: Allow customization of expiration date #22422

zhouyx opened this issue May 22, 2019 · 3 comments

Comments

@zhouyx
Copy link
Contributor

zhouyx commented May 22, 2019

The cookeWriter feature allow publisher to write cookie on the origin.

Right now, the expiration date is by default set to 1 year. We need to provide a way for publisher's to customize the cookie expiration date.

Proposed configuration

  'cookies': {
    'cookieMaxAge': 365*24*3600,
    'keyValue1': {
      'value': 'QEURY_PARAM(fake1)',
    }
  },

cookieMaxAge accepts a number unit in second. Which is the cookie will be expired after that amount of time.

Put cookieMaxAge: 604800 (604800=606024*7) if one wants the cooke to expire after 7 days.

cc @zikas

@zhouyx
Copy link
Contributor Author

zhouyx commented Jun 18, 2019

Closed by #22483
@zikas FYI: change in prod.

@AlexBenny
Copy link

Thanks for adding this feature. I'm a bit in doubt about how it should be used.

I would write a configuration like these one making the max age configurable:

"cookies": {
    "enabled": true,
    "cookieMaxAge": {
      "value": "$DEFAULT(${cookieMaxAge}, $CALC(86400, 365, multiply, true))"
    },
   ...
  },

reading the implementation of the cookie-writer.js I see that the value is directly converted to a number and the variables are not expanded:

const cookieMaxAgeNumber = Number(inputConfig['cookieMaxAge']);

Would it be possible to set the cookieMaxAge making that custom for the user?

I'm new on this technology so, please, let me know if there is something obvious I haven't considered or if I should send this question in a different channel or GH issue.

@mattitoo
Copy link

mattitoo commented Oct 6, 2022

Is there an answer to the question from @AlexBenny ?
We need this feature in our setup and it would be great if we could have some progress here.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants