httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Ruggeri <DRugg...@primary.net>
Subject Re: [users@httpd] How to proxy based on user agent?
Date Fri, 05 Oct 2012 14:36:10 GMT
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@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message