V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
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 · 2015-07-09 23:46:19 +08:00 · 3318 次点击
    这是一个创建于 3425 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 条回复    2015-07-10 00:02:15 +08:00
    holinhot
        1
    holinhot  
    OP
       2015-07-09 23:55:28 +08:00
    不知道刚刚哪弄错了现在又工作了

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

    return 444;

    }
    }
    holinhot
        2
    holinhot  
    OP
       2015-07-09 23:57:00 +08:00
    无语了 把5.1 xp搞错
    holinhot
        3
    holinhot  
    OP
       2015-07-10 00:02:15 +08:00
    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; );"
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2702 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 03:39 · PVG 11:39 · LAX 19:39 · JFK 22:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.