The new Java project studies online notes -day17 (X)

.1 needs analysis

A gateway device corresponds to a misplaced, interceptor that intercepts requests for multiple systems.
To use this section verify the user's identity gateway is legitimate.
4.2 Zuul Introduction
What is Zuul? Spring Cloud Zuul is the integration of micro-services gateway Net fl ix's Zuul open source projects implemented, which implements the request routing, load balancing, check misplaced functions. Official: https://github.com/Net FL ix / Zuul

What is a gateway?
Service gateway is arranged in front of a barrier micro-services, service request first to the gateway, a request will be misplaced, check routing process. With the services gateway can improve the security of micro-services gateway legality verification request, the request will not be lawful interception, denied access.
Zuul used in conjunction with Nginx how? Zuul and Nginx is required to work in practical projects, as shown below, is the role of Nginx reverse proxy, load balancing, Zuul's role is to protect secure access to micro-services, micro-interception service requests, check the legality and load balancing.
The new Java project studies online notes -day17 (X)
4.3 project to build a gateway
create gateway project (xc-govern-gateway): 1, create xc-govern-gateway project into "information" - "xc-govern-gateway.zip br /> 2, @ EnableZuulProxy
attention on the startup class use @EnableZuulProxy annotation identifies this project as Zuul gateway startup class code is as follows:

[mw_shl_code = AppleScript, to true] @SpringBootApplication
@EnableZuulProxy public class GatewayApplication {
public static void main (String [] args) {
SpringApplication.run (GatewayApplication.class, args);
}} [/ mw_shl_code]
4.4.1 Requirements Analysis
Zuul gateway having a proxy function forwarded to the service according to the micro request url, as shown below:
The new Java project studies online notes -day17 (X)

The client requests the gateway / api / learning, forwarding, via the routing / learning
client requests the gateway / api / course, forwarded by the route / course

Guess you like

Origin blog.51cto.com/13517854/2425676