|
@@ -0,0 +1,81 @@
|
|
|
+spring:
|
|
|
+ cloud:
|
|
|
+ gateway:
|
|
|
+ routes:
|
|
|
+ # 配置路由,可以配置多个
|
|
|
+ - id: BUSINESS-OAUTH2 # 自定义路由的ID 保持唯一
|
|
|
+ # 采用 LoadBalanceClient 方式请求,以 lb:// 开头,后面的是注册在 Nacos 上的服务名
|
|
|
+ #https://www.jianshu.com/p/9994b2da8645 LoadBalanceClient解释
|
|
|
+ uri: lb://business-oauth2
|
|
|
+ # Predicate 翻译过来是“谓词”的意思,必须,主要作用是匹配用户的请求,有很多种用法
|
|
|
+ predicates:
|
|
|
+ # 路径匹配,以 api 开头,直接配置是不生效的,看 filters 配置
|
|
|
+ - Path=/api/user/**
|
|
|
+ filters:
|
|
|
+ # 前缀过滤,默认配置下,我们的请求路径是 http://localhost:8888/business-oauth2/** 这时会路由到指定的服务
|
|
|
+ # 此处配置去掉 1 个路径前缀,再配置上面的 Path=/api/**,就能按照 http://localhost:8888/api/** 的方式访问了
|
|
|
+ - StripPrefix=1
|
|
|
+ - id: INTERNET-HOSP-WEB
|
|
|
+ uri: lb://internethospital-web
|
|
|
+ predicates:
|
|
|
+ - Path=/taihe/user/checkCardNo
|
|
|
+ filters:
|
|
|
+ - name: Auth
|
|
|
+ args:
|
|
|
+ url: '/'
|
|
|
+ #url匹配类型 regex: 正则, prefix: 前缀, full 全匹配
|
|
|
+ matchType: 'prefix'
|
|
|
+ replacePrefixUrl: false
|
|
|
+ auth: 'external-api'
|
|
|
+ authResponse401: true
|
|
|
+ #设置需要刷新的授权,当 auth 不为空,以 auth 的配置为主
|
|
|
+ refreshAuth: ''
|
|
|
+ setHeaders: [ ]
|
|
|
+ - id: HISAPI-TAIHE-COM
|
|
|
+ uri: lb://his-api-server
|
|
|
+ predicates:
|
|
|
+ - Host=hisapi.taihe.com
|
|
|
+ filters:
|
|
|
+ - name: Auth
|
|
|
+ args:
|
|
|
+ url: '/'
|
|
|
+ #url匹配类型 regex: 正则, prefix: 前缀, full 全匹配
|
|
|
+ matchType: 'prefix'
|
|
|
+ replacePrefixUrl: false
|
|
|
+ auth: 'external-api'
|
|
|
+ authResponse401: true
|
|
|
+ #设置需要刷新的授权,当 auth 不为空,以 auth 的配置为主
|
|
|
+ refreshAuth: ''
|
|
|
+ setHeaders: [ ]
|
|
|
+ - id: YWT-TEST-TAIHE-COM
|
|
|
+ uri: lb://ywt-api-server-test
|
|
|
+ predicates:
|
|
|
+ - Host=hisapi.taihe.com
|
|
|
+ filters:
|
|
|
+ - name: Auth
|
|
|
+ args:
|
|
|
+ url: '/'
|
|
|
+ #url匹配类型 regex: 正则, prefix: 前缀, full 全匹配
|
|
|
+ matchType: 'prefix'
|
|
|
+ replacePrefixUrl: false
|
|
|
+ auth: 'external-api'
|
|
|
+ authResponse401: true
|
|
|
+ #设置需要刷新的授权,当 auth 不为空,以 auth 的配置为主
|
|
|
+ refreshAuth: ''
|
|
|
+ setHeaders: [ ]
|
|
|
+ - id: YWT-TAIHE-COM
|
|
|
+ uri: lb://ywt-api-server
|
|
|
+ predicates:
|
|
|
+ - Host=hisapi.taihe.com
|
|
|
+ filters:
|
|
|
+ - name: Auth
|
|
|
+ args:
|
|
|
+ url: '/'
|
|
|
+ #url匹配类型 regex: 正则, prefix: 前缀, full 全匹配
|
|
|
+ matchType: 'prefix'
|
|
|
+ replacePrefixUrl: true
|
|
|
+ auth: 'external-api'
|
|
|
+ authResponse401: true
|
|
|
+ #设置需要刷新的授权,当 auth 不为空,以 auth 的配置为主
|
|
|
+ refreshAuth: ''
|
|
|
+ setHeaders: [ ]
|