在controller增加 注解
@CrossOrigin(origins = {"http://127.0.0.1","http://localhost:8080"},maxAge = 3600)
springcloud gateway配置文件增加
spring:
cloud:
gateway:
globalcors:
cors-configurations:
'[/**]':
allow-credentials: true
allowed-origins:
- "http://127.0.0.1"
- "http://localhost:8080"
allowed-headers: "idenid,adminId,Cookie,Content-Type"
allowed-methods:
- OPTIONS
- GET
- POST
max-age: 3600
网友评论