ExpressGateway / express-gateway

A microservices API Gateway built on top of Express.js
https://www.express-gateway.io
Apache License 2.0
2.96k stars 344 forks source link

Add retry mechanism #1068

Open 1204552371 opened 10 months ago

1204552371 commented 10 months ago

When the gateway proxy proxy sends a request error, there should be a retry mechanism. The same is true for forwarding including load balancing. In this way, error 502 caused by socket hang up and connect ECONNREFUSED can be avoided.

maxAutoRetries can be configured in gateway.config.yml. The default is 1. such as:

      - proxy:
          - action:
              serviceEndpoint: lbsmart
              maxAutoRetries: 1
              changeOrigin: true