I've been trying to get my apps to run after deploing them to a CloudFoundry instance. The instance I'm using will not allow to perform requests using http (they will simply timeout) so I have to route all requests to https.
The components/versions I am using are:
- Java 10
- Spring Boot 2.0.4.RELEASE/Spring Cloud Finchley.SR1
- spring-cloud-gateway
- spring-cloud-config-server
- spring-cloud-starter-netflix-eureka
The failing config
EurekaClient Config (in gateway and the backend where the gw should route to)
eureka: client: serviceUrl: defaultZone: ${DISCOVERY_SERVICE_URL:http://localhost:8061}/eureka/ instance: hostname: ${vcap.application.uris[0]:localhost} nonSecurePortEnabled: false securePortEnabled: true securePort: ${server.port} statusPageUrl: https://${eureka.instance.hostname}/actuator/info healthCheckUrl: https://${eureka.instance.hostname}/actuator/health homePageUrl: https://${eureka.instance.hostname}/ secure-virtual-host-name: https://${vcap.application.application_uris[0]} Gateway Config
spring: cloud: gateway: discovery: locator: enabled: true routes: - id: user-service uri: lb://user-service predicates: - Path=/user/** filters: - RewritePath=/user/(?<segment>.*), /$\{segment} Things I have already tried:
- Using
lb:https://user-servicelike described in docs -> Will have no effect as far as I can see - Use real urls to the apps (
uri: https://user-service.cf-instance.io) -> Routing works as expected.
But I do not want to define the urls in my config, they should returned by eureka and build up correctly by the gateway.
Thanks in advance
Edit:
Here is the output of /eureka/apps https://pastebin.com/WP3b6PQG
I am currently working to get the current code into GitHub I will edit this post when I've found the time to get a clear state.
Edit 2:
You can find the full example (With SpringCloudGateway, Eureka, ...) at my GitHub This is an running example, the applied config will not use the Eureka. To use Eureka the gateway-service-cloud.yml in config service has to be adopted.
- id: user-service uri: lb://user-service
Please ignore the documentation service, this will not work yet, I first need to rewrite the path.
<eurekaserver>/eureka/apps?/eureka/appsis exactly the same (except ip, timestamps and id).