netflix-ribbonspring-cloud-gateway

spring cloud gateway ribbon load balancing


Trying to get spring cloud gateway to load balance across a couple of instances of our application, but just can't figure it out. We don't have a service registry at present (no Eureka etc).

I've been trying to use ribbon and have a configuration like so:

spring:
  application:
    name: gateway-service  
  cloud:
    discovery:
        locator:
          enabled: true
    gateway:
      routes:
      - id: my-service
        uri: lb://my-load-balanced-service
        predicates:
        - Path=/
        filters:
        - TestFilter
ribbon:
  eureka:
   enabled: false
my-load-balanced-service:
  ribbon:
    listOfServers: localhost:8080, localhost:8081

However when I try a request to the gateway, I get a 200 response with content-length 0, and my stubs have not been hit.

I have a very basic setup, no beans defined.

How can I get ribbon to play nice / or an alternative?


Solution

  • You should check out whether spring-cloud-starter-netflix-ribbon dependency is on your project or not