我知道可以在rewritecond中检查GET查询字符串参数,如下所示:
RewriteCond %{REQUEST_URI} ^/somepath/somepath
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} try=3
RewriteCond %{QUERY_STRING} name=([^&]*)
RewriteRule ^/somepath/somepath(.*) /otherpath/otherpath?name=%1 [R]
我该如何检查请求体中的POST参数?我听说mod_security可以做到,但我没有找到任何关于如何使用mod_security和上面示例类似的mod_rewrite的示例。
我打算使用类似下面这样的方式处理POST:
RewriteCond %{REQUEST_URI} ^/somepath/somepath
RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^/somepath/somepath(.*) /otherpath/otherpath [PT]
除了我需要一个RewriteCond来检查POST参数中是否包含"try=3"。
modsecurity能否检查请求主体并将检查结果加载到环境变量中?那样可以起作用...