Add option to set cookie client side

Created on 20 January 2021, almost 4 years ago
Updated 13 September 2024, 3 months ago

Problem/Motivation

When using external cache and in some regards the Drupal page cache, the language cookie will keep on being set when it was once for a page (e.g. due to it not existing). This because the Drupal cached the setCookie response.
Cookies being set should not be cached however, so this might kill your external cache (e.g. default Varnish behaviour).
To circumvent this, you could tell Drupal not to cache any response that sets a cookie.

But then there is still the problem in Drupal caching a page without a setCookie and serving that to anyone visiting that page without a cookie, resulting in them not getting the language cookie.
This could also be circumvented by altering the default Drupal page cache behaviour, but it starts to get a little complicated.

Proposed resolution

The easy solution to both problems described above (without fancy circumventions) is having this module set its cookie via JS, or at least having the option to.

💬 Support request
Status

Needs work

Version

2.0

Component

Code

Created by

🇧🇪Belgium L_VanDamme

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024