Spring Cloud Gateway Not Forwarding Requests To HTTPS When Using Eureka Load Balancer

Viewed 20

I am working with microservices routing with Spring Cloud Gateway and registered in Eureka Server.

The microservices are running in multiple instances that's why I need to use Load Balancer in the gateway as below

spring:
  application:
    name: GATEWAY-NAME
  cloud:
    gateway:
      httpclient:
        wiretap: true
      httpserver:
        wiretap: true
      routes:
        - id: MICROSERVICE-NAME
          uri: lb://MICROSERVICE-NAME
          predicates:
            - Path=/path/**

This is working fine when the microservices are running on HTTP protocol without SSL. But when I enable SSL in the microservice servers, the upper configuration doesn't work. Rather it works when I use the URL directly instead of load balancer as below.

spring:
  application:
    name: GATEWAY-NAME
  cloud:
    gateway:
      httpclient:
        wiretap: true
      httpserver:
        wiretap: true
      routes:
        - id: MICROSERVICE-NAME
          uri: https://domain:port
          predicates:
            - Path=/path/**

Now I need to use the load balancer when SSL is enabled in the servers where microservices are running. I also tried uri: lbs://MICROSERVICE-NAME but didn't get any result.

How can I achieve my goal? Please let me know what should I do to redirect to HTTPS using the load balancer from gateway route.

0 Answers
Related