使用Zuul搭建网关,通过网关访问一个设置了延时的接口,结果并没有进入延时回调函数,而是直接显示超时。
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Aug 02 16:31:42 CST 2019
There was an unexpected error (type=Gateway Timeout, status=504).
com.netflix.zuul.exception.ZuulException: Hystrix Readed time out
直接访问延时接口,则能正常进入延时回调函数。
解决方法:
在Zuul网关服务的配置文件里添加:
ribbon:
ReadTimeout: 120000 #请求处理的超时时间
ConnectTimeout: 30000 #请求连接的超时时间
问题解决。