Zuul: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(11 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
name: ZuulProxy | name: ZuulProxy | ||
zuul: | zuul: | ||
sensitiveHeaders: Cookie,Set-Cookie | |||
routes: | routes: | ||
api: | api: | ||
path: /api/self/rest/** | path: /api/self/rest/** | ||
url: | url: https://localhost:2013/ebis/api/self/rest | ||
static: | static: | ||
path: /** | path: /** | ||
url: | url: https://localhost:2015/ | ||
server: | server: | ||
port: 1983 | port: 1983 | ||
eureka: | |||
client: | |||
registerWithEureka: false | |||
</source> | |||
==Conceptual== | |||
'''Zuul''' is an '''API Gateway''' or an '''Edge Server''' developed by Netflix. It is capable of performing the below tasks. | |||
# '''Authentication and Security:''' Identifying authentication requirements for each resource and rejecting requests that do not satisfy them. | |||
# '''Insights and Monitoring:''' Tracking meaningful data and statistics at the edge in order to give us an accurate view of production. | |||
# '''Dynamic Routing:''' Dynamically routing requests to different backend clusters as needed. | |||
# '''Stress Testing:''' Gradually increasing the traffic to a cluster in order to gauge performance. | |||
# '''Load Shedding:''' Allocating capacity for each type of request and dropping requests that go over the limit. | |||
# '''Static Response Handling:''' Building some responses directly at the edge instead of forwarding them to an internal cluster. | |||
==Filters== | |||
'''Filters''' are a way of extending '''Zuul’s''' default functionality and adding your own custom features. Filters can be divided into four types based on the stage that they are executed in, during the request routing process. | |||
# <code>pre</code> Filters run before the request is routed. | |||
# <code>route</code> Filters can handle the actual routing of the request. | |||
# <code>post</code> Filters run after the request has been routed. | |||
# <code>error</code> Filters run if an error occurs in the course of handling the request. | |||
==Netflix Eureka== | |||
'''Lookup for Version''' | |||
https://www.baeldung.com/spring-cloud-netflix-eureka | |||
https://github.com/eugenp/tutorials/tree/master/spring-cloud/spring-cloud-eureka | |||
'''Lookup for Dependency''' | |||
https://github.com/eugenp/tutorials/blob/master/parent-boot-2/pom.xml | |||
https://github.com/eugenp/tutorials/blob/master/spring-cloud/pom.xml | |||
https://github.com/eugenp/tutorials/blob/master/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml | |||
<source lang="xml"> | |||
<version.chorke.spring.cloud>2021.0.0</version.chorke.spring.cloud> | |||
<version.chorke.spring.boot>2.6.3</version.chorke.spring.boot> | |||
<dependency> | |||
<groupId>org.springframework.cloud</groupId> | |||
<artifactId>spring-cloud-dependencies</artifactId> | |||
<version>${version.chorke.spring.cloud}</version> | |||
<scope>import</scope> | |||
<type>pom</type> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.cloud</groupId> | |||
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.cloud</groupId> | |||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.cloud</groupId> | |||
<artifactId>spring-cloud-starter-openfeign</artifactId> | |||
</dependency> | |||
</source> | </source> | ||
==References== | ==References== | ||
{| | |||
| valign="top" | | |||
* [https://medium.com/@arjunac009/spring-boot-microservice-with-centralized-authentication-zuul-eureka-jwt-5719e05fde29 Spring Centralised Authentication using Zuul, Eureka & JWT] | * [https://medium.com/@arjunac009/spring-boot-microservice-with-centralized-authentication-zuul-eureka-jwt-5719e05fde29 Spring Centralised Authentication using Zuul, Eureka & JWT] | ||
* [https://developer.okta.com/blog/2018/02/13/secure-spring-microservices-with-oauth Secure a Spring Micro-services Architecture with OAuth] | * [https://developer.okta.com/blog/2018/02/13/secure-spring-microservices-with-oauth Secure a Spring Micro-services Architecture with OAuth] | ||
Line 27: | Line 85: | ||
* [https://github.com/Netflix/zuul/wiki Netflix Zuul Wiki] | * [https://github.com/Netflix/zuul/wiki Netflix Zuul Wiki] | ||
* [https://github.com/Netflix/zuul/tree/master/zuul-sample Zuul Sample] | * [https://github.com/Netflix/zuul/tree/master/zuul-sample Zuul Sample] | ||
| valign="top" | | |||
* [https://cloud.spring.io/spring-cloud-security/2.1.x/multi/multi__configuring_authentication_downstream_of_a_zuul_proxy.html Configuring Authentication Downstream of a Zuul Proxy] | |||
* [https://levelup.gitconnected.com/spring-cloud-zuul-api-gateway-dffa5933d570 Spring Cloud with Zuul API Gateway] | |||
* [https://www.baeldung.com/rest-api-spring-oauth2-angular Spring REST API OAuth2 Angular] | |||
* [[Netflix Eureka]] | |||
|} |
Latest revision as of 23:50, 9 February 2022
spring:
application:
name: ZuulProxy
zuul:
sensitiveHeaders: Cookie,Set-Cookie
routes:
api:
path: /api/self/rest/**
url: https://localhost:2013/ebis/api/self/rest
static:
path: /**
url: https://localhost:2015/
server:
port: 1983
eureka:
client:
registerWithEureka: false
Conceptual
Zuul is an API Gateway or an Edge Server developed by Netflix. It is capable of performing the below tasks.
- Authentication and Security: Identifying authentication requirements for each resource and rejecting requests that do not satisfy them.
- Insights and Monitoring: Tracking meaningful data and statistics at the edge in order to give us an accurate view of production.
- Dynamic Routing: Dynamically routing requests to different backend clusters as needed.
- Stress Testing: Gradually increasing the traffic to a cluster in order to gauge performance.
- Load Shedding: Allocating capacity for each type of request and dropping requests that go over the limit.
- Static Response Handling: Building some responses directly at the edge instead of forwarding them to an internal cluster.
Filters
Filters are a way of extending Zuul’s default functionality and adding your own custom features. Filters can be divided into four types based on the stage that they are executed in, during the request routing process.
pre
Filters run before the request is routed.route
Filters can handle the actual routing of the request.post
Filters run after the request has been routed.error
Filters run if an error occurs in the course of handling the request.
Netflix Eureka
Lookup for Version https://www.baeldung.com/spring-cloud-netflix-eureka https://github.com/eugenp/tutorials/tree/master/spring-cloud/spring-cloud-eureka Lookup for Dependency https://github.com/eugenp/tutorials/blob/master/parent-boot-2/pom.xml https://github.com/eugenp/tutorials/blob/master/spring-cloud/pom.xml https://github.com/eugenp/tutorials/blob/master/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml
<version.chorke.spring.cloud>2021.0.0</version.chorke.spring.cloud>
<version.chorke.spring.boot>2.6.3</version.chorke.spring.boot>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${version.chorke.spring.cloud}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>