问题
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