apache、iis、nginx禁止post请求

admin 2019-08-27 PM 300℃ 0条

apache

禁止非GET请求
RewriteEngine On
#RewriteCond %{REQUEST_METHOD} ^(POST|TRACE|OPTIONS)
RewriteCond %{REQUEST_METHOD} !(GET)
RewriteRule (.*) - [F]
#RewriteRule (.*) - [R=502,L]

iis

禁止非GET请求
   <match url="(.*)" ignoreCase="false" />
         <conditions logicalGrouping="MatchAll">
           <add input="{REQUEST_METHOD}" pattern="GET" ignoreCase="false" negate="true"/>
         </conditions>
         <action type="AbortRequest" />
  </rule>

nginx

禁止非GET、HEAD请求
if ($request_method !~ ^(GET|HEAD)$) {
  return 403;
  }
标签: nginx, apache, iis

非特殊说明,本博所有文章均为博主原创。