HTTP status code for overloaded server

空扰寡人 提交于 2019-12-12 08:22:09

问题


Some hours my web site's server has too much load.
Which HTTP status code should I send to the Googlebot that visits my website?

Is "269 Call Back Later" this suitable for this case, or 503 Service Unavailable or do you have any more suggestions?


回答1:


503 means the service is temporarily unavailable so it is appropriate to use while the server is overloaded. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

The Wikipedia article defines 269 as the initial response for a request that must be processed asynchronously. 269 means the request added something to the server's "queue" of things to do and the server will have a response available as soon as possible, whereas 503 means the server will not "remember" the request.

I've never heard of 269, though, and the first Google result for it is this question, followed by the Wikipedia article.




回答2:


Another option is a 429 - Too Many Requests response.

Defined in RFC6585 - http://tools.ietf.org/html/rfc6585#section-4

The spec does not define how the origin server identifies the user, nor how it counts requests.

For example, an origin server that is limiting request rates can do so based upon counts of requests on a per-resource basis, across the entire server, or even among a set of servers.

Likewise, it might identify the user by its authentication credentials, or a stateful cookie.

Also see the Retry-After header in the response.



来源:https://stackoverflow.com/questions/12022429/http-status-code-for-overloaded-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!