Lax / traffic-accounting-nginx-module

Monitor the incoming and outgoing traffic metrics in realtime for NGINX
https://github.com/Lax/traffic-accounting-nginx-module
BSD 2-Clause "Simplified" License
280 stars 77 forks source link

Make the http_accounting_id directive support on the if of the location context #21

Closed wangfakang closed 8 years ago

wangfakang commented 8 years ago

Hi @Lax : I did the following there points Pls review the code, and thx. make the http_accounting_id directive support on the location of the if context. may be it's useful for this:

    location / {
            # for pc
            http_accounting_id  accounting_id_pc;
            # for mobile
            if ($http_user_agent ~* '(Android|webOS|iPhone|iPod|BlackBerry)') {
                http_accounting_id  accounting_id_mobile;
            }
            ...
    }
Lax commented 8 years ago

Thanks for your countribution, will merge soon.

Personaly I would rather avoid 'if' in production. Ref:

  1. If is evil