Re: How to proxy based on user agent?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/4/2012 9:01 PM, Abhishek Gupta wrote:
> Dear group, 
>
> I want to run two sites (desktop and mobile version) under same server. 
>
> I want apache to proxy/redirect to appropriate application server based on user agent (msie/ipad).
>
> Currently, only desktop version is running and I am using proxypass directive.

Hello, Abhishek;
   You could switch to rewrites with [P]. You will still need
proxypassreverse to cover any redirects.

BrowserMatchNoCase ^.*iPhone.*$ mobilebrowser=true
BrowserMatchNoCase ^.*iPad.*$ mobilebrowser=true
BrowserMatchNoCase ^.*Android.*$ mobilebrowser=true

RewriteEngine On
RewriteCond %{ENV:mobilebrowser} true
RewriteRule /(.*)  http://mobile.backend.com/$1 [P,L]

RewriteRule /(.*)  http://desktop.backend.com/$1 [P]

ProxyPassReverse / http://mobile.backend.com/
ProxyPassReverse / http://desktop.backend.com/



Even the browsermatch directives are not required - you could use
additional conditions like...
RewriteCond %{HTTP_USER_AGENT} .*iPad.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} .*iPhone.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} .*Android.* [NC]
<the rest...>

-- 
Daniel Ruggeri


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux