spring-cloud-gateway 超时配置

spring-cloud-gateway 超时配置

  • 连接超时
  • 读取超时

全局超时配置

# 单位毫秒
server:
  port: 8080
spring:
  application:
    name: api-gateway
  cloud:
    gateway:
      httpclient:
      	# 连接超时
        connect-timeout: 5000
        # 读取超时
        response-timeout: 15000
	

个别接口超时配置

# 单位毫秒
server:
  port: 8080
spring:
  application:
    name: api-gateway
  cloud:
    gateway:
      routes:
      - id: demo
        uri: lb://demo
        predicates:
        - Path=/demo/**
        metadata:
        	# 读取超时
          response-timeout: 5000
          # 连接超时
          connect-timeout: 30000

猜你喜欢

转载自blog.csdn.net/leafcat7/article/details/134113654