|
@@ -65,5 +65,49 @@ npm run dev
|
|
|
默认密码: 123456
|
|
默认密码: 123456
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+### Gateway网关
|
|
|
|
|
+网关采用的是spring官方的网关组件,通过异步背压的高性能网关。路由配置是整个架构最为核心的功能
|
|
|
|
|
|
|
|
|
|
+ **路由及限流配置**
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+ routes:
|
|
|
|
|
+ #ADMIN 模块
|
|
|
|
|
+ - id: kxs-system-biz # 唯一的服务ID
|
|
|
|
|
+ uri: lb://kxs-system-biz # instances下的服务名称,实现负载均衡
|
|
|
|
|
+ predicates:
|
|
|
|
|
+ - Path=/v1/kxs/admin/** #当前服务的请求前缀,
|
|
|
|
|
+ filters:
|
|
|
|
|
+ # 过滤前缀
|
|
|
|
|
+ - StripPrefix=3
|
|
|
|
|
+ # 限流配置
|
|
|
|
|
+ - name: RequestRateLimiter
|
|
|
|
|
+ args:
|
|
|
|
|
+ key-resolver: '#{@remoteAddrKeyResolver}' #SPEL表达式去的对应的bean
|
|
|
|
|
+ redis-rate-limiter.replenishRate: 100 # 令牌桶每秒填充平均速率
|
|
|
|
|
+ redis-rate-limiter.burstCapacity: 200 # 令牌桶总容量
|
|
|
|
|
+ # 验证码处理
|
|
|
|
|
+ - ValidateCodeGatewayFilter #如果该服务需要验证码则开启此过滤器
|
|
|
|
|
+ # 解密过滤器
|
|
|
|
|
+ - RequestDecoderFilter
|
|
|
|
|
+```
|
|
|
|
|
+**网关跨域支持**
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+spring:
|
|
|
|
|
+ cloud:
|
|
|
|
|
+ gateway:
|
|
|
|
|
+ globalcors:
|
|
|
|
|
+ corsConfigurations:
|
|
|
|
|
+ '[/**]':
|
|
|
|
|
+ allowedOriginPatterns: "*"
|
|
|
|
|
+ allowed-methods: "*"
|
|
|
|
|
+ allowed-headers: "*"
|
|
|
|
|
+ allow-credentials: true
|
|
|
|
|
+ exposedHeaders: "Content-Disposition,Content-Type,Cache-Control"
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+ **网关加解密**
|
|
|
|
|
+ 解密使用的是标准的aes对称加密
|
|
|
|
|
+
|
|
|
|
|
|