且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

限制POST请求的服务器

更新时间:2023-02-26 13:52:45

这是块只会prevent员额从主机127.0.0.1以外的请求,你会得到一个403禁止响应。你可以尝试使用mod_rewrite和替换<极限>

That block will only prevent POST requests from hosts other than 127.0.0.1, and you will get a 403 Forbidden response. You could try using mod_rewrite and replace the <LIMIT> with:

RewriteCond %{REQUEST_METHOD} POST

# allow the server to POST to itself
RewriteCond %{REMOTE_ADDR} !127.0.0.1   

# allow POST from trusted users
RewriteCond %{REMOTE_ADDR} !123.456.789.123   

# send all other post requests to 403 forbidden
RewriteRule ^ / [F]   

如果您需要preFER到post请求发送到您的网站的主页上,而不是替换 [F] 的最后一行[R,L]

If you would prefer to send post request to the home page of your site instead replace [F] in the last line with [R,L]

您会替换 / 替换为您的主页是,如果它不只是 /

You'd replace the / with where your "home page" is if it isn't just /.