HTTP 408 和 504 错误有什么区别?

What is the difference between HTTP 408 and 504 errors?

这些都是超时错误,但是在 408 和 504 中谁超时了?

w3开始,408定义为:

The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.

...而 504 是:

The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request.

那么408中的'client'如果不是中介服务器又是谁呢?如果是实际的最终用户,服务器如何知道在他们发出请求之前等待他们的请求?

客户端是浏览器或客户端应用程序。服务器知道要等待一个请求,因为它已经接受了一个连接,或者已经读取了请求的一部分,比如 header 或两个。

Amazon 文档说明:http://docs.aws.amazon.com/en_en/elasticloadbalancing/latest/classic/ts-elb-error-message.html#ts-elb-errorcodes-http408

Indicates that the client cancelled the request or failed to send a full request

Mozilla 文档说明:https://developer.mozilla.org/en/docs/Web/HTTP/Status/408

The HTTP 408 Request Timeout response status code means that the server would like to shut down this unused connection. It is sent on an idle connection by some servers, even without any previous request by the client