-
-
- ---
- #端口
- server:
- #运行端口
- port: 11112
-
- ssl: 配置ssl
- key-store: classpath:xxx.work.jks
- key-store-password: a2bh5642ot3
- key-store-type: JKS
- enabled: true
-
-
-
-
- #spring:
- # cloud:
- # gateway:
- #
- ---
- #服务器信息
- spring:
- application:
- #服务注册名称
- name: service-getway
- cloud:
- gateway:
- default-filters:
- - DedupeResponseHeader=Vary Access-Control-Allow-Origin Access-Control-Allow-Credentials, RETAIN_FIRST #放入这个解决多从跨域问题 去除重复的 "Vary"、"Access-Control-Allow-Origin" 和 "Access-Control-Allow-Credentials" 字段,并保留第一个出现的字段
- discovery:
- locator:
- enabled: true #开启当前项目服务注册与发现功能 让下面的服务能用
- lower-case-service-id: true #把服务名转为小写
-
-
- routes:
- - id: one3
- uri: lb://com1
- predicates:
- - Path=/** # 断言,路径相匹配的进行路由(注意**为通配符)
- - Weight=suiyi,2
- - id: one4
- uri: lb://com2
- predicates:
- - Path=/** # 断言,路径相匹配的进行路由(注意**为通配符)
- - Weight=suiyi,3 #负载均衡设置轮询负载均衡为3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # - id: on1 # 路由的id,没有规定规则但要求唯一,建议配合服务名
- # #匹配后提供服务的路由地址
- # uri: http://localhost:11111
- ## uri: https://api.00000.work
- ## uri: https://00000.work:44443
- # predicates:
- # - Path=/** # 断言,路径相匹配的进行路由(注意**为通配符)
- # filters:
- # filters:
- # - RewritePath=/event-stream
- # - AddRequestHeader=Accept, text/event-stream
-
- # - id: on2
- # uri: http://localhost:11111
- # predicates:
- # - Path=/news/** #断言,路径相匹配的进行路由
- # - Host=00000.work:11112 #使用的是那个ip地址访问的这个网站
- # - Before=2021-10-19T13:10:11+08:00[Asia/Shanghai] #在这个时间前可以访问 还有一个在这个时间后可以访问 还有Between 放两个时间 在这个时间段能访问
- # - Cookie=abc,.{3} #标识Cookie必须携带abc值为三位
- # - RemoteAddr= 127.0.0.1 #设置允许那个ip能访问网关
- # - Header=Connection,keep-alive #必须包含这个参数 请求里面
- # - Method=get,post #标识请求必须是post
- # - Query=title #里面必须包含名称叫title属性
-
-
-
-
-
-
-
- ---