I'm running Apache 2.4.29 on Ubuntu 18.04. I'm also running PHP 7.2 and I can't update to 7.3 yet.
I need to update the PHP session cookie (PHPSESSID), as well as a few others, on a tracking widget that is intended to run cross-site.
I have tried many different proposed solutions, but none of them work. Mostly, nothing happens, and some of those workarounds even cause the cookies to not be set at all. The workarounds I have tried include doing a Header always edit in my .conf file for the particular service I'm trying to update.
Since updating the Apache config files didn't work, I tried doing it in my htaccess file, but that also does nothing or breaks the cookies.
I tried adding this to the beginning of my htaccess file:
Header always edit Set-Cookie ^(.*)$ "$1; HttpOnly; Secure; SameSite=None"
No changes to the cookie.
I then created a cookie in the htaccess to test that part:
Header set Set-Cookie "language=eng; path=/; HttpOnly; Secure; SameSite=None"
That worked for that new language cookie, but the rest of the cookies weren't event set.
This is what my current test htaccess file looks like:
Header set Set-Cookie "language=eng; path=/;"
Header always edit Set-Cookie ^(.*)$ "$1; HttpOnly; Secure; SameSite=None"
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
I would expect the language cookie to have the HttpOnly;Secure;SameSite=None
appended to the end, but it doesn't. According to Chrome Dev Tools, my Response Header just has this:
Set-Cookie: language=eng; path=/;
I have NO idea what I'm doing wrong. I have tried different combinations of regex expressions for the edit with no results.
Please help!!