Welcome! Log In Create A New Profile

Advanced

nginx user agent type detection

Calin Don
October 12, 2011 01:52PM
I have assembled a way to detect user agent types by using ideas from:
http://notnotmobile.appspot.com/

This is the inital work I came up with:

map $http_user_agent $agent_type_phase1 {
default 'mobile';
'' 'unknown';
~*iphone|ipod|blackberry|palm|windows\s+ce 'mobile';
~*windows|linux|os\s+[x9]|solaris|bsd 'desktop';
~*spider|crawl|slurp|bot|feedburner 'bot';
}
map $http_x_skyfire_phone $agent_type_phase2 {
default 'mobile';
'' $agent_type_phase1;
}
map $http_x_operamini_phone_ua $agent_type {
default 'mobile';
'' $agent_type_phase2;
}

Please suggest any improvements. It is available also on
https://gist.github.com/1281950

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx user agent type detection

Calin Don October 12, 2011 01:52PM

Re: nginx user agent type detection

Brian Akins October 12, 2011 03:20PM

Re: nginx user agent type detection

Nginx User October 12, 2011 03:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 288
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready