# if

「Module ngx_http_rewrite_module/if」
「If Is Evil」

# 判断用户使用IE浏览器
if ($http_user_agent ~ MSIE) {
    rewrite ^(.*)$ /msie/$1 break;
}

# 判断referer是否合法
# 参考valid_referers指令
if ($invalid_referer) {
    return 403;
}

参考文献

 

  • WikiNotes/http rewrite module
  • Module ngx_http_rewrite_module
  • Modify $request_uri in Nginx
  • Nginx reverse proxy + URL rewrite
  • Nginx proxy_pass root and specific url only
  • how to reverse proxy via nginx a specific url?
  • How to preserve request url with nginx proxy_pass
  • NGINX proxy_pass with URI modification