We are implementing an Apache (Apache 2.4) server and we want to set expiration date for cookies. In the configuration file, we used the command like this
Header set Set-Cookie testcookie=%{UNIQUE_ID}e "expr=-z %{req:Cookie}"
Header set Cache-Control "max-age=7200, public"
Header set Expires "Sat, 21 Apr 2018 17:00:00 GMT"
The expiration date is not being set. In the cookie expires field it says "When the browsing session ends"
Except the code above, we have also tried the commands in htaccess file, the code is like this:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 day"
ExpiresByType image/x-icon "access plus 1 day"
ExpiresByType image/gif "access plus 1 day"
ExpiresByType image/png "access plus 1 day"
ExpiresByType image/jpg "access plus 1 day"
ExpiresByType image/jpeg "access plus 1 day"
ExpiresByType text/css "access 1 day"
ExpiresByType application/javascript "access plus 1 day"
ExpiresDefault "access plus 30 days"
</IfModule>
In addition, we have already load the the expires_module,cache_module, and unique_id module, the result still remains the same.
What else should we try?