AWS - 如何设置 HTTP 502 超时?

AWS - How to set HTTP 502 timeout?

我们有一个运行 api 的 elasticbeanstalk 应用程序。现在,对 API 的请求通常需要数十秒才能得到满足。我曾经在发送请求 60 秒后获得请求的 http 504 Gateway_Timeout。

So I set the 'Idle timeout' of the load balancer to 1800s.

现在我在 60 秒后收到 HTTP 502 代理错误:

如何修复它,即使请求花费的时间超过 60 秒,我也不会收到 http 500 错误?

如有任何建议,我们将不胜感激。谢谢。

我怀疑根本不是elastic load balancer,而是驻留在elastic beanstalk环境容器中的HTTP服务器。

您需要配置此服务器的超时时间。这通常可以通过“.ebextensions”文件来完成。您基本上可以使用此方法将默认的 httpd 文件替换为您自己的自定义文件。

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html

除了已接受的答案之外还有一些链接: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-tomcat-proxy.html#java-tomcat-proxy-apache

Where to add .ebextensions in a WAR?

https://httpd.apache.org/docs/2.4/mod/core.html#timeout