according to spring cloud zuul 8.1.3 zuul timeout, the following configuration should make zuul timeout after 20 seconds, however, it times out at 10 seconds.
server:
port: 8769
spring:
application:
name: service-zuul
zuul:
host:
connect-timeout-millis: 20000
socket-timeout-millis: 60000
zuul:
routes:
tp:
path: /**
url: http://localhost:9998
ribbon:eureka:enabled: false
From console output one can see that the interval between filter and timeout exception is only 10 seconds. which means the zuul.host.connect-timeout-millis does not work.
解决方案
I finally found a solution:
I used properties before and this is the first time to try yml, it seems that an item must be aggregated into one prefix:
zuul:
host:
connect-timeout-millis: 20000
socket-timeout-millis: 60000
routes:
tp:
path: /**
url: http://localhost:9998
In this way the backend server could have at most 60 seconds to respond. Besides, I also found that the sequence in configuration matters.