V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
holinhot
V2EX  ›  NGINX

nginx 定向 http_user_agent 怎么无效啊

  •  
  •   holinhot · Jul 9, 2015 · 3767 views
    This topic created in 3948 days ago, the information mentioned may be changed or developed.

    location / {
    if ($http_user_agent ~* "Windows NT 5.1") {

    return 444;
    
                }
                    }
    

    MacBook-Pro:~ louis$ curl -I -A "Windows NT 5.2" hao.123.com/00132233423434
    HTTP/1.1 302 Found
    Server: gws
    Date: Thu, 09 Jul 2015 15:46:07 GMT
    Content-Type: text/html
    Content-Length: 254
    Connection: keep-alive
    Keep-Alive: timeout=60
    Location: http://hao.123.com/

    MacBook-Pro:~ louis$ curl -I -A "Windows NT 5.2" hao.123.com/
    HTTP/1.1 200 OK
    Server: gws
    Date: Thu, 09 Jul 2015 15:47:09 GMT
    Content-Type: text/html
    Content-Length: 29792
    Last-Modified: Thu, 09 Jul 2015 13:20:05 GMT
    Connection: keep-alive
    Keep-Alive: timeout=60
    ETag: "559e7505-7460"
    Accept-Ranges: bytes

    3 replies    2015-07-10 00:02:15 +08:00
    holinhot
        1
    holinhot  
    OP
       Jul 9, 2015
    不知道刚刚哪弄错了现在又工作了

    location / {
    if ($http_user_agent ~* "Windows NT 5.2") {

    return 444;

    }
    }
    holinhot
        2
    holinhot  
    OP
       Jul 9, 2015
    无语了 把5.1 xp搞错
    holinhot
        3
    holinhot  
    OP
       Jul 10, 2015
    hehe


    242.119.21.11 - - [09/Jul/2015:12:01:20 -0400] "GET /bxiwn.gif HTTP/1.1" 444 0 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; );"
    244.229.10.82 - - [09/Jul/2015:12:01:21 -0400] "GET /nrgnpjei.htm HTTP/1.1" 444 0 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; );"
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2507 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 06:32 · PVG 14:32 · LAX 23:32 · JFK 02:32
    ♥ Do have faith in what you're doing.