跨域:域名或者端口不一致就会产生跨域问题,只针对浏览器禁止请求发起者和服务端发生跨域ajax请求,此请求会被拦截。
配置如下
server:
port: 10010
spring:
application:
name: gateway
cloud:
nacos:
server-addr: localhost:8848 # nacos服务地址
gateway:
globalcors:
add-to-simple-url-handler-mapping: true
cors-configurations:
'[/**]':
allowed-origins:
- "http://localhost:63343"
allowed-methods:
- "GET"
- "POST"
allowedHeaders: "*"
allowCredentials: true
max-age: 360000