add_header Set-Cookie The difference between Max-Age and Expires

c0nw0nk nginx-forum at
Sat Sep 10 12:46:51 UTC 2016

Just fixed my problem completely now :)

For anyone who also uses Lua and wants to overcome this cross browser
compatibility issue with expires and max-age cookie vars.

if ($host ~* www(.*)) {
 set $host_without_www $1;
set_by_lua $expires_time 'return ngx.cookie_time(ngx.time()+2592000)';
add_header Set-Cookie

Posted at Nginx Forum:,269438,269452#msg-269452

More information about the nginx mailing list