I have spring cloud gateway + spring cloud eureka discovery server + 2 services
I want all requests from one of my services to be redirected to the second service, but in the discovery service I have several replicas of the first service, and in the host predicate (auth_login_route) I want to write not the exact address of my service, but its name, so that gateway takes the exact address from the discovery service
first service name = users.service
second service name = auth.service
spring gateway application.yml file ->
server:
port: 8080
spring:
application:
name: gateway.service
cloud:
gateway:
mvc:
routes:
- id: users_route
uri: lb://users.service
predicates:
- Path=/users/**
- id: auth_login_route
uri: lb://auth.service
predicates:
- Host=**.users.service
discovery:
locator:
enabled: 'true'
lower-case-service-id: true
eureka:
client:
fetchRegistry: true
registerWithEureka: false
serviceUrl:
defaultZone: http://localhost:8761/eureka
instance:
preferIpAddress: true
I tried that, but I only got 400 exception in response
user26765565 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.