I would like to cache a 301 redirect. Most of the questions are about how to avoid the cache. I was thinking to add this in php :
$seconds_to_cache = 3600 * 60 * 24 * 1000;
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
header("Expires: $ts");
header("Pragma: cache");
header("Cache-Control: max-age=$seconds_to_cache");
Would it be better if I do this in nginx config? If yes, how should the config look like? Did anyone try this? Do modern browser(chrome, firefox, mobile browsers) keep the cache? Do they lose the cache after the restart?
Thanks