在临时站点中断/停机期间,我应该返回什么HTTP状态?


12

我将关闭我的网站以升级代码。我想在升级过程中显示一个临时的停机页面。为了防止僵尸程序在停机期间尝试对我的网站进行爬网的问题,我应该确保在此窗口内返回什么HTTP响应?

Answers:


13

根据RFC,对返回的正确响应为503-服务不可用

10.5.4 503服务不可用

由于暂时 服务器过载或维护,服务器当前无法处理该请求。这意味着这是一个暂时性状况,经过一段时间的延迟后会缓解。如果知道的话,延迟的长度可以在Retry-After头中指出。如果没有给出Retry-After,则客户端应该像处理500响应那样处理响应。

  Note: The existence of the 503 status code does not imply that a
  server must use it when becoming overloaded. Some servers may wish
  to simply refuse the connection.

我会提高您的答复,但目前还不到15个代表。不过,您已经勾选了。:) 谢谢!
马特·哈金斯

没问题.. :)
Izzy
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.