Skip to content

This project demonstrates spring-cloud-Netflix-zuul gateway service with routing filters

Notifications You must be signed in to change notification settings

santhoshvernekar/spring-cloud-netflix-zuul-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring-cloud-Netflix-Zuul gateway service

This project demonstrates spring-cloud- Netflix-zuul gateway service with routing filters

To Build project:

run mvn clean install

Zuul acts as an API gateway or Edge service,the Zuul is built to enable dynamic routing, monitoring, resiliency, and security.

It provides a range of different types of filters,

  • pre filters – are invoked before the request is routed.
  • post filters – are invoked after the request has been routed.
  • route filters – are used to route the request.
  • error filters – are invoked when an error occurs while handling the request.

We can implement these filters by extending a class ZuulFilter, I have implemented a sample filter to add location in the request header (AddRequestHeaderFilter class)

Steps for demo:

  • [optional] To check the service getting registered with service discovery, we need to run the service discovery on our machine, You can find project in my repo eureka-service-discovery
  • Step 1: Launch the service discovery
  • Step 2: Add @EnableZuulProxy annotation on Main class to enable the Zuul proxy
  • Step 3: We need to run some client apps to see routing through proxy ( hello application and goodbye application ) , launch them
  • Step 4: Zuul by default uses application name for routing

For example: If gateway service is running on port 8080 and hello application running on 1111 and goodbye application running on 2222 port

You can hit the hello and goodbye application end points on port 8080 only (hello and goodbye applications end points can be accessed using http://localhost:8080/hello and http://localhost:8080/goodbve) . The user need not to know the exact port on which hello and goodbye applications are running, the proxy or gateway service is managing this routing in the background

  • Step 5: You can find the location is getting in the request header which is coming from zuul proxy.

Happy Coding!!

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

Spring Cloud Netflix Maintenance Mode

The dependencies listed below are in maintenance mode. We do not recommend adding them to new projects:

  • Zuul

The decision to move most of the Spring Cloud Netflix projects to maintenance mode was a response to Netflix not continuing maintenance of many of the libraries that we provided support for.

Please see this blog entry for more information on maintenance mode and a list of suggested replacements for those libraries.

Releases

No releases published

Packages

No packages published

Languages