I use Spring Cloud in my microservice project with Eureka and Zuul. I want to communicate between my microservices using a Feign client. Say i have a microservice Microservice1 and Microservice2. In addition, i have the Eureka microservice and the Zuul microservice.
Zuul is configured as follows:
zuul:
ignoredServices: "*"
sensitiveHeaders: Authorization
routes:
empty_calls:
path: /
serviceId: microservice1
microservice1:
path: /microservice1/**
serviceId: microservice1
microservice2:
path: /microservice2/**
serviceId: microservice2
host:
connect-timeout-millis: 10000
socket-timeout-millis: 60000
In my Microservice2, I have the following Feign client:
@FeignClient(name = "microservice1")
public interface Microservice1Client {
@RequestMapping(value = "/test/this_is_a_test",
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
ResponseEntity<Boolean> addTestObject(@RequestBody List<String> userMails);
}
My problem is the following: I want the feign client to call my REST service via e.g. localhost:8080/microservice1/test/this_is_a_test. Instead, it calls "http://microservice1/test/this_is_a_test". I don't want to configure the feign client manually using the url attribute - it works automatically in other applications, but not for this specific configuration. Can anybody help me here?
Edit
The Eureka dashboard: