Re: Redirect 1 time per day

From: Willy Tarreau <>
Date: Tue, 18 May 2010 20:18:33 +0200

On Tue, May 18, 2010 at 04:15:31PM +0200, Damien Hardy wrote:
> Hi all,
> I have a request from my users:
> We want iphones (hdr_sub(user-agent) -i iphone) to be redirected to Apple
> store the first time thez come on our site. but only 1 time per days.
> So I want to user the "redirect" directive
> acl iphone hdr_sub(User-Agent) -i iphone
> acl seen hdr_sub(cookie) SEEN=1
> redirect location set-cookie SEEN=1
> if iphone !seen
> But how to set the cookie : expires=/TOMOROW/ ?

For this you should use the Max-Age attribute which takes an expiration value in seconds. It's not included in the redirect mechanism, but you should be able to use a trick to force it in the set-cookie value :

   redirect location set-cookie SEEN=1;Max-Age=86400 if iphone !seen

Willy Received on 2010/05/18 20:18

This archive was generated by hypermail 2.2.0 : 2010/05/18 20:30 CEST