mirror of
https://gitee.com/dromara/sa-token.git
synced 2024-11-29 18:37:49 +08:00
新增跨域介绍文章
This commit is contained in:
parent
fd5a162c75
commit
4584388c25
@ -62,10 +62,11 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
.setHeader("Access-Control-Allow-Origin", origin)
|
||||
// 允许所有请求方式
|
||||
.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE")
|
||||
// 允许的header参数
|
||||
.setHeader("Access-Control-Allow-Headers", "x-requested-with,satoken")
|
||||
// 有效时间
|
||||
.setHeader("Access-Control-Max-Age", "3600")
|
||||
// 允许的header参数
|
||||
.setHeader("Access-Control-Allow-Headers", "x-requested-with,satoken");
|
||||
;
|
||||
|
||||
// 如果是预检请求,则立即返回到前端
|
||||
SaRouter.match(SaHttpMethod.OPTIONS)
|
||||
|
@ -52,10 +52,11 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
.setHeader("Access-Control-Allow-Origin", "*")
|
||||
// 允许所有请求方式
|
||||
.setHeader("Access-Control-Allow-Methods", "*")
|
||||
// 有效时间
|
||||
.setHeader("Access-Control-Max-Age", "3600")
|
||||
// 允许的header参数
|
||||
.setHeader("Access-Control-Allow-Headers", "*");
|
||||
.setHeader("Access-Control-Allow-Headers", "*")
|
||||
// 有效时间
|
||||
.setHeader("Access-Control-Max-Age", "3600")
|
||||
;
|
||||
|
||||
// 如果是预检请求,则立即返回到前端
|
||||
SaRouter.match(SaHttpMethod.OPTIONS)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# 解决跨域问题
|
||||
|
||||
参考:[https://blog.csdn.net/shengzhang_/article/details/119928794](https://blog.csdn.net/shengzhang_/article/details/119928794)
|
||||
<!-- 参考:[https://blog.csdn.net/shengzhang_/article/details/119928794](https://blog.csdn.net/shengzhang_/article/details/119928794) -->
|
||||
|
||||
参考:[https://juejin.cn/post/7247376558367981627](https://juejin.cn/post/7247376558367981627)
|
||||
|
@ -350,7 +350,7 @@ String name = StpUtil.getSession().getString("name");
|
||||
|
||||
|
||||
### Q:我加了 Sa-Token 的全局过滤器,浏览器报错跨域了怎么办?
|
||||
参考:[https://blog.csdn.net/shengzhang_/article/details/119928794](https://blog.csdn.net/shengzhang_/article/details/119928794)
|
||||
参考:[https://juejin.cn/post/7247376558367981627](https://juejin.cn/post/7247376558367981627)
|
||||
|
||||
|
||||
### Q:前后端分离项目中,前端使用 vue,如果不打开 porxy 代理的话,调用 Sa-Token 登录不会将 token 自动注入到 Cookie 中,是因为跨域么?
|
||||
|
Loading…
Reference in New Issue
Block a user