netflix-zuul

How to route in between microservices using Spring Cloud & Netflix OSS

强颜欢笑 提交于 2019-12-03 03:13:32
问题 During our development of microservices using Spring Cloud, we started out using Zuul as a proxy for any connection from the outside to microservices, and for any microservice needing to contact another microservice. After some time we made the conclusion that Zuul was designed to be an edge service (only proxying traffic from the outside to the microservices), and shouldn't be used for intermicroservices communication. Especially the way Spring Cloud recommends the use of eureka to make a

Can Zuul Edge Server be used without Eureka / Ribbon

北慕城南 提交于 2019-12-03 01:57:49
We have an infrastructure with service discovery and load balancing (i.e. server side with STM and weblogic cluster). Now we are in the process of refactoring into micro-services. We would need an API gateway which does basic routing to other microservices. Netflix Zuul looks a good candidate however I could not get Zuul working without Eureka - but we do not need Eureka since we already have service discovery and load balancing in place. Is it possible to use Zuul without Eureka and Ribbon? If yes please provide some guild-lines since the there's no mention about in the wiki. Thanks. Yes, it

Use Eureka despite having random external port of docker containers

懵懂的女人 提交于 2019-12-02 22:42:21
I am writing an application that is composed of a few spring boot based microservices with a zuul based reverse proxy in the front- It works when I start the services on my machine, but for server rollout I'd like to use docker for the services, but this seems not to be possible right now. Normally you would have a fixed "internal" port and randomized ports at the outside of the container. But the app in the container doesn't know the outside port (and IP). The Netflix tools match what I would want to write an efficient microservice architecture and conceptually I really like docker. As far as

How is Spring Cloud Gateway different from Zuul?

走远了吗. 提交于 2019-12-02 17:23:58
I have been using Zuul as the edge service and API Gateway. Recently I have noticed that Spring Cloud Platform release Spring Cloud Gateway . What is the difference between the two gateways? Why is the Zuul not extended to support the functionalities in S-C-Gateway? What was the driving factor for a new library altogether? When should it be used? I am the author of spring cloud gateway. Zuul is built on servlet 2.5 (works with 3.x), using blocking APIs. It doesn't support any long lived connections, like websockets. Gateway is built on Spring Framework 5, Project Reactor and Spring Boot 2

Zuul - Api Gateway Authentication

女生的网名这么多〃 提交于 2019-12-02 15:09:50
I want to introduce Zuul through Spring Cloud as an API Gateway in front of a few services. I have some design doubts around Authentication. The Authentication would be handled by Spring Security, which comes before Zuul in the servlet filter chain. My concern: the Gateway would sit in front of many services some services may expose endpoints which do not require authentication some services may expose endpoints which need a Session Id and some with a token", an arbitrary opaque value (for example downloading a file if you know a "hard to guess" url) In the API Gateway/Spring Security you can

How to select route based on header in Zuul

孤者浪人 提交于 2019-12-02 06:05:52
问题 I'm using a Netflix Zuul proxy in front of my services A and B. How can I make the Zuul proxy to choose between routes to A and B based on a HTTP header in the incoming request? 回答1: You should create a prefilter based on your logic. Something like this : @Component public class RedirectionFilter extends ZuulFilter { @Override public String filterType() { return "pre"; } @Override public int filterOrder() { return 2; } @Override public boolean shouldFilter() { return true; } @Override public

Adding Headers to Zuul when re-directing

微笑、不失礼 提交于 2019-12-01 18:09:07
I am trying to use Zuul to redirect calls to a downstream system somewhere else. In the re-direct, I need to add in a Header with necessary data for the api receiving the redirection to process. I can't seem to get the downstream system to detect this data. Attached is my code. I am using Zuul from Edgware.SR3, Spring Boot 1.5.12 Zuul Filter @Component public class RouteFilter extends ZuulFilter{ @Override public Object run() { //Testing to add header context.getRequest().getParameterMap().put("api", new String[]{"api"}); context.getResponse().setHeader("api", api); context

Overriding Zuul Filter SendErrorFilter

时光怂恿深爱的人放手 提交于 2019-12-01 13:26:03
The class org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter handles error responses. I would like to override this filter to do a custom response instead of the ZuulException while forwarding etc. How can I replace this with my own version? Just write and register? Would that do it or is there something else needed? all you need to do is create a ZuulFilter and expose it as an @Bean . It needs to be in order before SendErrorFilter which is set to 0 . You might need to remove "error.status_code" from the RequestContext so SendErrorFilter doesn't run. You will need to disable a

Refresh of Zuul configuration when using Spring Config Service

别等时光非礼了梦想. 提交于 2019-12-01 12:17:32
We have a Zuul proxy (wraped with Spring Cloud/Boot) deployed that fetches configuration from the Spring Config Server. Every time I do changes in the routes I restart Zuul application and I wonder if there is a better approach that can be taken (like refresh of Zuul config information)? :) Thank you, You can issue a refresh command via rest: curl -X POST http://<host>:<port>/refresh I wrote a simple bash script that commits all my changes to the config file in the Git repository and then issue curl request to all my services. If you wanted to be fancy you could write a script that first

Basic Authentication service called By Zuul

不羁岁月 提交于 2019-12-01 10:58:21
I'm Zuul as edge server. so all request pass by this edge server. I have a micro-service A. all web services of A are protected by Basic Authentication. How can we call the services of A b passing by Zuul proxy? Should I add header for messages? Ideally the requester would have the token in the request. If you want to have Zuul add the authentication token then you can create a ZuulFilter and use: context.addZuulRequestHeader("Authorization", "base64encodedTokenHere"); Doing this would give open access to the services - which may not be wise. This is my Zuul filter: public class