AWS Elastic BeansTalk Nginx Timeout 504 Bad Gateway - Java Servlet AsyncContext

我的梦境 提交于 2021-02-11 06:18:27

问题


I have successfully ran tests of a java servlet app that runs on the base sample app provided by Amazon AWS Elastic BeansTalk. Java-Gradle-Jetty Platform. Now I can't achieve to keep the servlet connected more than 50 seconds with the client no matter what I do. Things I tried. Nginx proxy_read_timeout works! proxy_send_timeout doesn't work. Load Balancer Idle Timeout Does work.. keepalive_timeout doesn't work.

I have played around with these and a few more settings so I'm getting familiar and can restrict or bump the time outs but only to 50 seconds. Passed that I get a 504 Bad Gateway error which means connection was closed. I also get this error in the error.log for the nginx server. {sometime} [error] 23115#0: *2 upstream timed out (110: Connection timed out) while reading response header from upstream, client: {Some IP}, server: , request: "GET /{some path} HTTP/1.1", upstream: "http://127.0.0.1:5000/publish", host: "{Some Load Balancer URL}.us-west-1.elb.amazonaws.com"

Any help will be appreciated I've spent a few sleepless nights now.


回答1:


it ended up being two properties that needed to be passed on the nginx configuration file under the location section.

proxy_send_timeout and proxy_read_timeout

just set them to whatever time you wanna have in seconds in combination with the ELB (Load Balancer) timeout.

hope it's useful for someone.



来源:https://stackoverflow.com/questions/42011788/aws-elastic-beanstalk-nginx-timeout-504-bad-gateway-java-servlet-asynccontext

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