Skip to content

Field "set_cookie_for_domain" not working for non-subdomains

When I enter a domain into the set_cookie_for_domain field that is not a subdomain, the cookie banner on the current page no longer works, and the cookies are not set on the entered domain.

For better understanding:

  • Domain example.de with the setting set_cookie_for_domain set to example-2.de → After confirming the cookies, the cookie banner on example.de does not set the cookie cookie_optin anymore, and as a result, the cookie banner appears after every page reload.

  • Domain example-2.de → The cookie settings from example.de are not taken into account.

Am I doing something wrong? Does the set_cookie_for_domain field only apply to direct subdomains?

The documentation seems like it should work with normal domains (not only subdomains)

You can use this field to manually specify what the domain for the cookie must be. Without this setting, this configuration applies only to the domain where it is stored. With this setting you can use the cookie configuration for multiple domains, for example by writing example.com so that the configuration is used for both dev.example.com and www.example.com.


I also tested it locally with two domains in the same installation - example.ddev.site and example2.ddev.site

example.ddev.site should set the cookies for example2.ddev.site so I set the field set_cookie_for_domain to example2.ddev.site.

This results in the same behaviour as mentioned above. If I enter .ddev.site as set_cookie_for_domain, it is working as expected.

Tested in Chrome, with sgalinski 6.0.8 and TYPO3 12.4

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information