Zuul: Difference between revisions
Jump to navigation
Jump to search
(7 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: | ||
Line 11: | Line 12: | ||
path: /** | path: /** | ||
url: https://localhost:2015/ | url: https://localhost:2015/ | ||
server: | server: | ||
port: 1983 | port: 1983 | ||
eureka: | eureka: | ||
client: | 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> | ||
Line 36: | Line 89: | ||
* [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://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://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>