› NGINX
› NGINX Trac
› 3rd Party Modules
› Security Advisories
› CHANGES
› OpenResty
› ngx_lua
› Tengine
在线学习资源
› NGINX 开发从入门到精通
NGINX Modules
› ngx_echo
aoscici2000
V2EX  ›  NGINX

Nginx 不建议使用 if 的话, 还能怎样控制只允许 GET 请求

  •  
  •   aoscici2000 · Dec 10, 2019 · 5360 views
    This topic created in 2502 days ago, the information mentioned may be changed or developed.
    if ($request_method != GET) {                                  
        return 405;
    }
    

    例如

    2 replies  •  2019-12-10 23:20:58 +08:00
    sagaxu
        2
    sagaxu  
       Dec 10, 2019 via Android
    The only 100% safe things which may be done inside if in a location context are:

    return ...;
    rewrite ... last;
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   969 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 19:15 · PVG 03:15 · LAX 12:15 · JFK 15:15
    ♥ Do have faith in what you're doing.