I'm seeing a 504 response for a long request using the Spring Cloud Zuul gateway pattern. The timeout occurs exactly 1 minute after the request was issued.
I've tried the following to no avail:
zuul:
ribbon:
ConnectTimeout: 10000000
ReadTimeout: 10000000
and:
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 10000000
and
hystrix:
command:
default:
execution:
timeout:
enabled: false
None of these prevents the gateway timeout after a minute.
Ribbon Read Timeout Property ReadTimeout property will solve the problem. Add the following property to an application. properties file of your Zuul Api Gateway and restart your application. Note: The value is provided in milliseconds and that the property name is case-sensitive.
If Zuul uses service discovery, you need to configure these timeouts with the ribbon. ReadTimeout and ribbon. SocketTimeout Ribbon properties.
Zuul is built on servlet 2.5 (works with 3. x), using blocking APIs. It doesn't support any long lived connections, like websockets. Gateway is built on Spring Framework 5, Project Reactor and Spring Boot 2 using non-blocking APIs.
Creating Zuul Server ApplicationAdd the @EnableZuulProxy annotation on your main Spring Boot application. The @EnableZuulProxy annotation is used to make your Spring Boot application act as a Zuul Proxy server. You will have to add the Spring Cloud Starter Zuul dependency in our build configuration file.
It turned out to be the Idle timeout value of the AWS Elastic Load Balancer. I increased the idle timeout to 3 minutes and the problem went away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With