Giter VIP home page Giter VIP logo

nginx-ua-parse-module's Introduction

nginx-ua-parse-module

nginx-ua-parse-module adds the ability to use BrowserScope's user agent strings to parse device, os and browser families into nginx variables.

It converts the YAML version of the regexes into json that can be replaced without re-building the module into the binary.

Idea came because we at Brow.si searched for efficient way to speed-up analytics data processing, and what's more fast than storing the logged data calculated? :)

Installation

$ ./configure --add-module=/path/to/nginx-ua-parse-module
$ make && make install

Generating regexes.json (requires Node.js)

$ npm install
$ node generate-regexes.js

Usage

    http {
        ...
        log_format userinfo '$remote_addr of kind $ua_parse_device_kind ($ua_parse_device running $ua_parse_os, device brand $ua_parse_device_brand, device model $ua_parse_device_model) with $ua_parse_browser version $ua_parse_browser_ver';
        ...
        server {
            uaparse_list /path/to/regexes.json;  # specify regexes file
            ...
            location ... {
                ...
                uaparse_enable on;  # enable useragent parsing here
                access_log	logs/userinfo.log userinfo;
                ...
            }
            ...
        }
    }

uaparse_list directive

uaparse_list directive is used on server level to specify regexes file for given server. Argument given to this directive is path to file.

uaparse_enable directive

uaparse_enable directive is used on server/location level to enable UA parsing on given server. Please note that it is off by default and must be enabled explicitly on server or location level, so regexes arrays are not iterated on every request.

uaparse_var directive

uaparse_var directive is used to explicitly specify the variable UA will be taken from.

Credits

nginx-ua-parse-module's People

Watchers

 avatar  avatar

Forkers

rjblopes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.