# gz-gateway 网关模块
基于`Spring Cloud Gateway`组件实现的网关
![原理图](doc/img/spring-cloud-gateway.png)

导入依赖
```xml
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-gateway</artifactId>
    </dependency>
```

## HTTP转发
根据微服务注册中心(cctp-eureka)里注册的微服务自动转发`application.yaml`配置片段：
```yaml
spring:
  cloud:
    gateway:
      discovery:
        locator:
          enabled: true
          lower-case-service-id: true
```


## HTTP SESSION管理
引用Spring提供的sesion管理组件，通过redis共享session信息
```xml
  <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis-reactive</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.session</groupId>
        <artifactId>spring-session-data-redis</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-pool2</artifactId>
    </dependency>
  </dependencies>
```


