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

c0nw0nk nginx-forum at forum.nginx.org
Sat Sep 10 14:39:44 UTC 2016


I am sure (well would hope) they would have the common sense to edit it to
their own needs.

B.R. Wrote:
-------------------------------------------------------
> I just hope that code won't be used by the owner of wwwooowww.wtf for
> example.
> ---
> *B. R.*
> 
> On Sat, Sep 10, 2016 at 2:46 PM, c0nw0nk <nginx-forum at forum.nginx.org>
> wrote:
> 
> > 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
> > "value=1;domain=$host_without_www;path=/;expires=$expires_
> > time;Max-Age=2592000";
> >
> > Posted at Nginx Forum: https://forum.nginx.org/read.
> > php?2,269438,269452#msg-269452
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> >
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,269438,269456#msg-269456



More information about the nginx mailing list