Closed chinfeng closed 5 years ago
That's not enough information. What is your configuration and how to reproduce the error
Here is demo project.
eureka -> gateway -> hello
And then access http://localhost:8080/hello/
It just work fine in Finchley.M9 version. You can change it in build.gradle or root project.
I think i found the problem.
ServiceInstance::getServiceId is returning upper case name since Finchley.RC1. Route pattern is created in upper case ( /HELLO/** in my demo project for example ). The org.springframework.web.util.pattern.LiteralPathElement instance using by PathRoutePredicateFactory is case sensitive ( prop caseSensitive is true) .
So it always return 404 because "/HELLO/**"not matching with "/hello/" while caseSensitive==true
Not working for me with 'Finchley.RELEASE' and Spring boot '2.0.3.RELEASE' My configuration:
build.gradle
dependencies {
compile 'org.springframework.boot:spring-boot-starter-actuator',
'org.springframework.boot:spring-boot-starter-webflux',
'org.springframework.cloud:spring-cloud-starter-consul-discovery',
'org.springframework.cloud:spring-cloud-starter-gateway',
'org.springframework.boot:spring-boot-starter-aop',
'org.springframework.retry:spring-retry'
}
bootstrap.properties
spring.application.name=edge-service
spring.cloud.gateway.discovery.locator.enabled=true
spring.cloud.consul.discovery.health-check-path=/actuator/health
spring.cloud.consul.host=${CONSUL_HOST:localhost}
application.properties
server.port=8080
management.endpoints.web.exposure.include=*
Application.class
@EnableDiscoveryClient
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
GET http://localhost:8080/actuator/gateway/routes
returns empty list.
@chinfeng for eureka it has always returned upper case. There is a property to force the route to lowercase, I'll find it later.
Thanks @spencergibb .
But why this problem wasn't there unitl Finchley.RC1 ?
I found this property work:
spring.cloud.gateway.discovery.locator.lowerCaseServiceId=true
@longshine Thanks! It works!
But this property doesn't included in documents even Finchley.RELEASE.
Please check your dependency like below
it should not contain like below
Please remove -mvc from in dependency.
The spring.cloud.gateway.discovery.locator.enabled property not working since updated Finchley from M9 to RC2. It just keep response 404 all the time.