故意发送 403 响应
Deliberately sending a 403 response
我工作的网站在检测到可疑行为后暂时禁止用户访问。目前,用户被跳转到一个页面,该页面的内容很少 UI,并且会显示一条消息,告诉他们他们的访问已被拒绝。
此页面当前 returns 的响应代码为 200,我打算将其更改为 403,因为我相信这有助于提醒垃圾邮件机器人它们已被阻止。
所以,简而言之,页面将保持原样,功能不会改变,只是响应代码会从 200 -> 403 改变。
这是可取的还是我可能会导致我没有预料到的问题?
根据 403 的定义,我觉得很合理:
10.4.4 403 Forbidden
The server understood the request, but is refusing to fulfill it.
Authorization will not help and the request SHOULD NOT be repeated.
If the request method was not HEAD and the server wishes to make
public why the request has not been fulfilled, it SHOULD describe the
reason for the refusal in the entity. If the server does not wish to
make this information available to the client, the status code 404
(Not Found) can be used instead.
我工作的网站在检测到可疑行为后暂时禁止用户访问。目前,用户被跳转到一个页面,该页面的内容很少 UI,并且会显示一条消息,告诉他们他们的访问已被拒绝。
此页面当前 returns 的响应代码为 200,我打算将其更改为 403,因为我相信这有助于提醒垃圾邮件机器人它们已被阻止。
所以,简而言之,页面将保持原样,功能不会改变,只是响应代码会从 200 -> 403 改变。
这是可取的还是我可能会导致我没有预料到的问题?
根据 403 的定义,我觉得很合理:
10.4.4 403 Forbidden The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.