Re: Redirect 1 time per day

From: Willy Tarreau <w#1wt.eu>
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 http://itunes.apple.com/us/app/myapp/ 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 http://itunes.apple.com/us/app/myapp/ set-cookie SEEN=1;Max-Age=86400 if iphone !seen

Regards,
Willy Received on 2010/05/18 20:18

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