title: Add Secure and SameSite Flags to Every Set-Cookie in Apache 2.4
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>I tried adding this to the beginning of my htaccess file:</p>
  
  <pre><code>Header always edit Set-Cookie ^(.*)$ "$1; HttpOnly; Secure; SameSite=None"
  </code></pre>
  
  <p>No changes to the cookie.</p>
  
  <p>I then created a cookie in the htaccess to test that part:</p>
  
  <pre><code>Header set Set-Cookie "language=eng; path=/; HttpOnly; Secure; SameSite=None"
  </code></pre>
  
  <p>That worked for that new language cookie, but the rest of the cookies weren't event set.</p>
  
  <p>This is what my current test htaccess file looks like:</p>
  
  <pre><code>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] 
  </code></pre>
  
  <p>I would expect the language cookie to have the <code>HttpOnly;Secure;SameSite=None</code> appended to the end, but it doesn't. According to Chrome Dev Tools, my Response Header just has this: 
  <code>Set-Cookie: language=eng; path=/;</code></p>
  
  <p>I have NO idea what I'm doing wrong. I have tried different combinations of regex expressions for the edit with no results.</p>
  
  <p>Please help!!</p>