Reputation: 601
I'm adding to my php script a 503 header statement. In all examples I've seen, this is followed by some variation of:
header('Retry-After: 300');
Is it necessary to include the "Retry-After" statement? I'd prefer not to.
Upvotes: 0
Views: 6065
Reputation: 2650
For anyone who ends up here like me, you may also want to read this thread, which contains significantly broader discussion on the same topic
Upvotes: 1
Reputation: 21448
Retry-After header is a measure you can adopt to tell clients to back off.
Services that deal with lots of traffic usually have loop detection logic, to detect clients that call expensive APIs too often. For example, a misbehaving client would be asking for auth tokens from an authentication service every few seconds, instead of caching tokens until they expire.
Of course, there is no guarantee that a client will obey the retry-after rule, in which case you can throttle them harder.
Upvotes: 0
Reputation: 2337
No it is not necessary.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
"The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response."
If known, the length of the delay MAY be indicated in a Retry-After header.
Upvotes: 2