Re: Redirect 1 time per day

From: Damien Hardy <damien.hardy#laposte.net>
Date: Tue, 18 May 2010 17:01:50 +0200 (CEST)


>
> 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/ ?
>
> I use haproxy 1.3 packaged by debian lenny.
>
> Thanks a lot.
>
> Best regards,
>

Hmm I have much problems :
here is my version of haproxy :
ii haproxy 1.3.15.2-2+lenny2 fast and reliable load balancing reverse proxy

when I try to load my new conf :
ha03:~# /etc/init.d/haproxy reload
Reloading haproxy: haproxy[ALERT] 137/165103 (27677) : parsing [/etc/haproxy/haproxy.cfg:117] : unknown keyword 'redirect' in 'listen' section
[ALERT] 137/165103 (27677) : Error reading configuration file : /etc/haproxy/haproxy.cfg
 failed!

But whene I read the documentation for 1.3 there is a redirect directive available in listen section (
http://haproxy.1wt.eu/download/1.3/doc/configuration.txt#redirectlocation for those how use my script ;)

What's is wrong ?

( BTW I notice a mistake in the explanaition of the <code> option of this "redirect" directive : 301 and 302 are both "Moved permanently" in the doc)

best regards,

-- 
Damien
Received on 2010/05/18 17:01

This archive was generated by hypermail 2.2.0 : 2010/05/18 17:15 CEST