Gateway resolving to http endpoints when microservice is https enabled
Microservice 'IMPS-BENEFICIARY-SERVICE' is https enabled. Not sure if the issue with eureka discovery mechanism or the gateway.
RoutePredicateHandlerMapping.lambda$getHandlerInternal$0(94) Mapping [Exchange: POST https://127.0.0.1/imps/ReqPay/2.0/urn:txnid:DTYabf72ee5d7cd4d7c8d455cf377bf5d21] to Route{id='issuer_request', uri=lb://IMPS-BENEFICIARY-SERVICE, order=0, predicate=Paths: [/imps/Req**/**], match trailing slash: true, gatewayFilters=[], metadata={}}
ReactiveLoadBalancerClientFilter.filter(108) ReactiveLoadBalancerClientFilter url before: lb://IMPS-BENEFICIARY-SERVICE/imps/ReqPay/2.0/urn:txnid:DTYabf72ee5d7cd4d7c8d455cf377bf5d21
ReactiveLoadBalancerClientFilter.lambda$filter$2(143) LoadBalancerClientFilter url chosen: http://192.168.0.4:47229/imps/ReqPay/2.0/urn:txnid:DTYabf72ee5d7cd4d7c8d455cf377bf5d21
What discovery system are you using? What versions? What is your configuration?
Discovery Server
spring-cloud-starter-netflix-eureka-server : 4.1.2
Gateway Dependencies
Spring Boot : 3.3.2
spring-cloud-starter-gateway: 4.1.5
spring-cloud-starter-netflix-eureka-client : 4.1.3
MicroService Dependencies
Spring Boot Version : 3.3.2
spring-cloud-starter-netflix-eureka-client : 4.1.2
Microservice SSL configuration
server:
ssl:
key-alias: ****
key-store: classpath:imps/ssl.pfx
key-store-password: ***
key-store-type: PKCS12
enabled: true
Gateway Configuration
spring:
application:
name: gateway
cloud:
gateway:
routes:
- id: issuer-route
uri: lb://IMPS-BENEFICIARY-SERVICE
predicates:
- Path=/imps/Req**/**
discovery:
locator:
enabled: true
lower-case-service-id: true
Please add the eureka configuration for the services
Microservice Eureka Configuration
eureka:
client:
register-with-eureka: true
fetch-registry: true
serviceUrl:
defaultZone: 'http://admin:password@localhost:8761/eureka/'
instance:
preferIpAddress: true
instanceId: '${spring.application.name}:${random.int}'
Resolved by setting 'secure-port-enabled' to true. Couldn't find this anywhere in documentation.
eureka:
client:
register-with-eureka: true
fetch-registry: true
serviceUrl:
defaultZone: 'http://admin:password@localhost:8761/eureka/'
instance:
preferIpAddress: true
instanceId: '${spring.application.name}:${random.int}'
secure-port-enabled: true
secure-port: ${server.port}
status-page-url: https://${eureka.hostname}:${server.port}/actuator/info
health-check-url: https://${eureka.hostname}:${server.port}/actuator/health
home-page-url: https://${eureka.hostname}${server.port}/
https://docs.spring.io/spring-cloud-netflix/reference/spring-cloud-netflix.html#_registering_a_secure_application