I met similar questions on different posts, but they are useless for me (no answer or no helpful answer). I'm going describe all details here and hope for help.
I use java8, spring boot 2.0.3, spring cloud elements are based on Finchley.RELEASE version.
In my test micro services application I have next services: config-server, discovery-service (Eureka), edge-service (zuul), card-service. All services loads at start time their own configuration from configuration-server. Services are started without issues.
card-service - gets random port at start time. This is a reason of configuring zuul rout to calendar-service by serviceId
.
zuul:
debug:
request: true
routes:
card-service:
path: /card-service/**
serviceId: card-service
stripPrefix: true
Using discovery-service client I detected next registered services ["edge-server", "card-service"]
. So zuul route uses same serviceId (card-service
). The service name is correct because it is the same in card-service app bootstrap.yml
:
spring:
application:
name: card-service
I use direct access to card-service
by:
(i configured same result for it). - works fine.
My Zuul (edge-server is started on 8765
port) so I expect navigation by
gives same result. But result is empty. Checking edge-server logs:
No handler mapping found for [/card-service/api/cards]
Last-Modified value for [/card-service/api/cards] is: -1
Check via actuator mappings for edge-server (http://localhost:8765/actuator/mappings - I've demonstrated here most interested part):
{
"contexts": {
"edge-server-1": {
"mappings": {
"dispatcherServlets": {
"dispatcherServlet": [
...,
{
"handler": "org.springframework.cloud.netflix.zuul.web.ZuulController@24a37416",
"predicate": "/card-service/**",
"details": null
},
Question
Is any idea how to fix route mapping for zuul?