跨域问题

2022-03-18  本文已影响0人  从零开始的程序猿生活

在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

上一篇 下一篇

猜你喜欢

热点阅读