Re: Redirect 1 time per day

2013-05-24 Thread Jonathan Matthews
On 24 May 2013 09:14, swapan  wrote:
> I want to set the redirection for blackberry mobiles along with other mobile
> phones.what exact acl should i put in there in the haproxy config file.

Your question is overly broad and can't be answered without more
detail, but I would suggest you start by looking at
http://en.wikipedia.org/wiki/WURFL for a generic solution to this
problem. I'm not sure if anyone has it integrated with HAProxy,
however.

Regards,
Jonathan
--
Jonathan Matthews // Oxford, London, UK
http://www.jpluscplusm.com/contact.html



Re: Redirect 1 time per day

2010-05-18 Thread Willy Tarreau
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




Re: Redirect 1 time per day

2010-05-18 Thread Hervé COMMOWICK

Hello,

On 05/18/2010 05:01 PM, Damien Hardy wrote:

ii  haproxy 1.3.15.2-2+lenny2 fast and reliable load balancing reverse proxy
What's is wrong ?
Your HAProxy version doesn't include this feature, please update to *at 
least* the lenny-backports version.


Regards,

Hervé.

--
Your Network supports your *BUSINESS !*
Appliances de *contrôle d'activité* et d'*optimisation* du réseau
EXCELIANCE - Rule your Network ! -www.exceliance.fr






Re: Redirect 1 time per day

2010-05-18 Thread Damien Hardy
>
> 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  option of this
"redirect" directive : 301 and 302 are both "Moved permanently" in the
doc)

best regards,

-- 
Damien






Redirect 1 time per day

2010-05-18 Thread Damien Hardy
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,

-- 
Damien