Monthly Archives: July 2012

Serving Mobile users using nginx

Found a very good solution to the problem i was facing. 

Here is a nice resource which Andries used to redirect mobile users to the mobile website . 

I however wanted to serve different content from the same web address. I took this further and did :- 

location / {
if ($mobile_request = '1') {
proxy_pass http://127.0.0.1:<port-for-mobile>;
}
if ($mobile_request != '1') {
proxy_pass http://127.0.0.1:<port-for-normal>;
}
}

This way the 80 server can also use microcache rules based on the backend server. Hope it helps out a couple of folks.