Zuul filter requests - spring-boot

I am using Zuul as reverse proxy deployed as a service using Spring Boot. And I have a configuration like:
zuul:
routes:
home:
path: /**
url: localhost:8080
But I want to use the /routes,/info,/health endpoints of the zuul server. Also I want add some endpoints to the zuul server. The problem is that I lost those endpoints because all requests are routed to localhost:8080.

ignoredPatterns in the latest version of ZUUL can help prevent reaching the /** mapping:
zuul:
ignoredPatterns: "/routes/**,/info/**,/custom/**"

Related

How to register non Spring Boot MicroService in Eureka discovery server

I have recently installed a micro service infrastraucture based on Spring Boot + Spring Cloud.
My Spring Boot microservices register in my Eureka server and Zuul automaticaly redirects requests to them.
I have a Drupal content manager that exposes content through REST interface and I'd like it to take part in the discovery rave party. How can I have my drupal register it self in the Eureka server so Zuul redirects the corresponding calls to it?
As an ugly workaround I wonder if I can have automatic discovery and routing running in Zuul while manually configuring some REST paths to be redirected to the drupal server? (Using zuul.routes... property files)
I found that I can add manual zuul routes in bootstrap.yaml
I have tried adding it in the application yaml property files in configuration server but for some reason they are ignored when the Eureka discovery server is working.
Anyway, bootstrap.yaml works. Example:
zuul:
routes:
mta_api:
path: /mta_api/**
url: http://my-non-springboot-rest-service.com/
stripPrefix: false
You could add sidecar to your non-springboot application. This would allow Eureka support.
Source: Dead- http://cloud.spring.io/spring-cloud-static/Edgware.SR4/single/spring-cloud.html#_polyglot_support_with_sidecar
Current: https://cloud.spring.io/spring-cloud-static/Dalston.SR5/multi/multi__polyglot_support_with_sidecar.html

Zuul Routing w/o Spring-Cloud

Is it possible to define/configure route : endpoint Url mapping in Zuul when spring-cloud / spring boot is not used?
Yes, for services without spring you can specify the url.
More info: http://cloud.spring.io/spring-cloud-static/Camden.SR6/#netflix-zuul-reverse-proxy
zuul:
routes:
users:
path: /myusers/**
url: http://example.com/users_service

How to get the service endpoint registered behind the Application name in Eureka Server?

I have some web services registered at Spring Boot Eureka Server. Is there any way I can check the endpoints registered at Eureka Server, with respect to all the application?
e.g: Eureka server
Service1 means Request will be routed to service endpoint: localhost:9080/service1
Service2 means Request will be routed to service endpoint: localhost:9088/service2
Service3 means Request will be routed to service endpoint: localhost:9085/service3
You can check the Eureka dashboard at http://host-name:8761 (Change the port if you're using a different one).
Secondly, Eureka doesn't route any request. It is just a service registry and keeps the records of the Microservices and its instances. You need an API Gateway (ZUUL) or similar to do the routing along with client side load balancers (ribbon, etc.).
You can configure the zuul endpoints in the application.yml (or properties) file like below to access your service endpoints.
zuul:
ignoredServices: "*"
routes:
service1:
path: /service1/**
service2:
path: /service2/**
If you want to access the service1, then your endpoint will be something like http://localhost:8765/service1/{custom-path}
Note: 8765 is the default zuul port. Change it accordingly.

Spring Cloud Zuul: how to add route without restart

I am writing microservices with Spring Cloud.
I'm also using Zuul as the API Gateway which routes some URLs to destination services which are not registered into Eureka.
When a new route needed to be added to Zuul, we often edit the application.yml file and then restart the Zuul server.
I was wondering is there a way to add new route into Zuul without restarting the Zuul server?
I found this link useful but it only works for services registed in Erueka.

Cannot access the microservice through the gateway

I am not experienced in spring micro services and zuul configuration so I will need some help.
I have a microservice running on jhipster-registry and I am trying to access the microservice from my application through the gateway.
In my application I have this service in the current routes:
If I am accessing the service when my application is started as a spring boot app everything works fine; but when I deploy my application on tomcat the same request returns 404.
Here is the zuul config :
zuul:
routes:
assessmentapi:
path: /assessmentapi/**
serviceId: assessmentapi
url: http://192.168.80.44:8081/assessment-api
and http get request
$http.get('/assessmentapi/main/....)
You should not write the URL part in your configuration. As we can see on your gateway screenshot, the gateway already knows the service's IP thanks to Eureka and the Registry. IP addresses should never go into the config as those are determined dynamically.

Resources