{"id":13697638,"url":"https://github.com/alibaba/nginx-http-user-agent","last_synced_at":"2025-10-14T08:46:26.925Z","repository":{"id":2935794,"uuid":"3947645","full_name":"alibaba/nginx-http-user-agent","owner":"alibaba","description":"A nginx module to match browsers and crawlers","archived":false,"fork":false,"pushed_at":"2019-05-04T21:27:29.000Z","size":116,"stargazers_count":162,"open_issues_count":1,"forks_count":54,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-05-03T20:33:52.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://tengine.taobao.org","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alibaba.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-06T07:09:27.000Z","updated_at":"2024-07-09T09:43:06.000Z","dependencies_parsed_at":"2022-09-04T11:31:21.408Z","dependency_job_id":null,"html_url":"https://github.com/alibaba/nginx-http-user-agent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alibaba/nginx-http-user-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fnginx-http-user-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fnginx-http-user-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fnginx-http-user-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fnginx-http-user-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alibaba","download_url":"https://codeload.github.com/alibaba/nginx-http-user-agent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fnginx-http-user-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018299,"owners_count":26086345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T18:01:01.043Z","updated_at":"2025-10-14T08:46:21.897Z","avatar_url":"https://github.com/alibaba.png","language":"C","funding_links":[],"categories":["Third Modules","Third Party Modules","Honourable mentions"],"sub_categories":["C Modules"],"readme":"# HTTP user_agent module for Tengine\n#syntax:\n\nuser_agent $variable_name {\n    greedy        name;\n\n    name [([+|-]version) | (version1~version2)]  value;\n}\n\nif ($variable == value) {\n    echo hello;\n}\n\n\n## Introduction\n\ngreedy:\nWe specify the keyword in the user_agent string from right to left, and this is more efficient. As usual, we use the greedy algorithm. It will return immediately after the keyword being found.\n\nE.g 1. \"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)\", this string is MSIE's user_agent string, we will return when we find the keyword \"MSIE\". But the truth is not alway like this:\nE.g 2. \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.20 (KHTML, like Gecko) Chrome/19.0.1036.7 Safari/535.20\", This is Chrome's user_agent. We will match Safari frist. If we define safari is greedy, it scans the string in a reverse order. If a keyword is greedy, it will not return when it matches the keyword at the first time. It will continue to scan the string.\n\ndefault:\nset the default value of this variable;\n\nThe directive format is like this in the block:\nname   version    value;\n\nname: the name of operating_system, browser, crawler and so on;\nversion: It can be omitted, and it support multiple formats;\nvalue: It is the value filled to the variable;\n\nfor example:\n\nuser_agent $example {\n    #set default value\n    default                                             msie;\n\n    #define safari is greedy\n    greedy                                             safari;\n\n    #match exact version\n    msie                6.0                             1;\n\n    #match interval\n    msie                7.0~8.0                         2;\n\n    #match greater than version 9.0\n    msie                9.0+                            3;\n\n    #match less than version 4.0 (include 4.0)\n    msie                4.0-                            4;\n\n    #match all\n    Chrome                                              5;\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibaba%2Fnginx-http-user-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falibaba%2Fnginx-http-user-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibaba%2Fnginx-http-user-agent/lists"}