yml 配置SpringCloudGetaway跨域,配置路由规则
properties.yml 文件里配置#路由规则 负载均衡和网关跨域问题的配置如下:spring:cloud:gateway:# 以下为路由规则:routes:- id: gulimall-pms_routeuri: lb://gulimall-pmspredicates:- Path=/pms/**- id: gulimall-oms_route
·
application.yml 文件里配置
#路由规则 负载均衡和网关跨域问题的配置如下:
spring:
cloud:
gateway: # 以下为路由规则:
routes:
- id: gulimall-pms_route
uri: lb://gulimall-pms
predicates:
- Path=/pms/**
- id: gulimall-oms_route
uri: lb://gulimall-oms
predicates:
- Path=/oms/**
- id: gulimall-sms_route
uri: lb://gulimall-sms
predicates:
- Path=/sms/**
- id: gulimall-ums_route
uri: lb://gulimall-ums
predicates:
- Path=/ums/**
- id: gulimall-wms_route
uri: lb://gulimall-wms
predicates:
- Path=/wms/**
#以下为 跨域配置
default-filters:
- DedupeResponseHeader=Access-Control-Allow-Origin, RETAIN_UNIQUE
globalcors:
cors-configurations:
'[/**]':
allow-credentials: true # 允许携带认证信息
allowedOrigins: "*" # 允许跨域的源(网站域名/ip),设置*为全部
allowedMethods: "*" # 允许跨域的method, 默认为GET和OPTIONS,设置*为全部
allowedHeaders: "*" # 允许跨域请求里的head字段,设置*为全部
更多推荐
已为社区贡献1条内容
所有评论(0)