美文网首页
跨域问题

跨域问题

作者: 从零开始的程序猿生活 | 来源:发表于2022-03-18 10:39 被阅读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

相关文章

网友评论

      本文标题:跨域问题

      本文链接:https://www.haomeiwen.com/subject/tzsidrtx.html