apache - 为拒绝服务 (DoS) 攻击返回的正确 HTTP 响应代码是什么?

标签 apache rest http servlets webserver

我在 Web 服务器中有一些逻辑来查明用户是否试图进行 DoS 攻击。但是为此返回的正确 HTTP 响应代码是什么?另外,我可以在 HTTP 正文中放入什么好的错误消息,以礼貌地告诉用户他已进入 DoS 攻击路径?

最佳答案

But what's the correct HTTP response code to return for that?

RFC 6585建议 429 Too Many Requests

The 429 status code indicates that the user has sent too many requests in a given amount of time ("rate limiting").

如果攻击损害了您处理合法请求的能力,那么您可能会用 503 Service Unavailable 回应这些请求.

请注意语义上的变化 - 发送错误请求的人从 4NN 客户端错误类中获得状态,而那些没有错误的人从 5NN 内部服务错误类中获得状态。

what's a good error message I can put in HTTP body to tell the user politely that he's got into the DoS attack path?

停止?

关于apache - 为拒绝服务 (DoS) 攻击返回的正确 HTTP 响应代码是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46664695/

相关文章:

php - 使用 htaccess 和 php 创建动态子目录

java - 适用于 Android 应用程序的 REST API

javascript - 无法在 Express 响应中发送对象

java - 如何修改 HttpEntity 的内容

php - 拒绝通过 htaccess 直接访问文件夹和文件

python - 使用 Python Flask 运行 REST API 版本的最佳方式是什么

php - 应使用哪些 HTTP 状态代码来为下载管理器提供建议?

java - 访问 HTTP 和 HTTPS URL 时出现禁止错误

javascript - 提供 JavaScript 文件时,默认 gzip 是否安全

php - http apache 服务器不处理 php 文件