51Degrees / Device-Detection

THE Fastest and most Accurate device detection for C / PHP / Perl / Python and Node.js - professionally maintained device data
https://51degrees.com/device-detection
Other
112 stars 46 forks source link

ipad and iphone detection nginx module #24

Closed mesouug closed 6 years ago

mesouug commented 6 years ago

Good day.

I've tried both trie and pattern (lite version) for nginx and it seems that plugin doesn't detect difference between ipad and iphone (tried on real devices) even though it clearly states which is which in user agent. I've used nginx config from example. Please let me know if this is expected behavior.

Thanks.

JoshGrew51D commented 6 years ago

Hi There

Please could you send over the information below and I will look into this for you.

Thanks Josh

mesouug commented 6 years ago

User agents:

Mozilla/5.0 (iPad; CPU OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0 Mobile/15D100 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1

Part of nginx config:

    ## Do a single User-Agent match for device information ##
    51D_match_single x-device HardwareName,BrowserName,PlatformName;

    ## Do a multiple HTTP header match for IsMobile, IsTablet and IsSmartphone ##
    51D_match_all x-mobile IsMobile;
    51D_match_all x-tablet IsTablet;
    51D_match_all x-smartphone IsSmartPhone;

    ## Do a multiple HTTP header match for match metrics ##
    51D_match_all x-metrics DeviceId,Method,Difference,Rank;

    ## Add to response headers for easy viewing. ##
    add_header x-device $http_x_device;
    add_header x-mobile $http_x_mobile;
    add_header x-tablet $http_x_tablet;
    add_header x-smartphone $http_x_smartphone;
    add_header x-metrics $http_x_metrics;
JoshGrew51D commented 6 years ago

With Lite you don't have access to the following properties that are going to indicate a refined result in this instance.

IsTablet, IsSmartPhone, HardwareName

IsMobile will indicate if the device's primary data connection is wireless and the device is designed to operate mostly by battery power. IsSmartPhone and IsTablet can then be used to separate these into tablets, etc.

Apple intentionally obfuscates device identifier information within User-Agents. As a result, the properties you are are able to to return as a result with Lite will be the same for iPad and iPhone.

You can see our full property dictionary here.

We do have a free trial for our Enterprise product available if you would like to explore the full range of data we offer.

mesouug commented 6 years ago

Thank you for detailed explanation.