nginx 配置: location @get_master { default_type text/html; content_by_lua_file /usr/local/nginx/conf/test.lua; } location ~ /post/ { proxy_pass http://www.test.com; } test.lua: if ngx.var.request_body ~= nil then local post_str = string.lower(ngx.var.request_body); local pos = string.find(post_str,'select'); if pos ~= nil then ngx.exit(404); else ngx.exec("/post/"); end else ngx.exec("/post/"); end 访问文件如下: (责任编辑:IT) |