切换导航条
此项目
正在载入...
登录
mmm-go
/
partnermg
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
tangxvhui
5 years ago
提交
b8c55338bc1b2883d829858c2aab65daf71feb74
1 个父辈
134dd114
更新
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
3 行增加
和
3 行删除
pkg/port/beego/controllers/base_controller.go
pkg/port/beego/middleware/allow_cors.go
pkg/port/beego/controllers/base_controller.go
查看文件 @
b8c5533
...
...
@@ -91,8 +91,8 @@ func (controller *BaseController) Finish() {
////Prepare 重写 beego.Controller 的Prepare方法
func
(
controller
*
BaseController
)
Prepare
()
{
//跨域处理
controller
.
Ctx
.
ResponseWriter
.
Header
()
.
Set
(
"Access-Control-Allow-Origin"
,
"*"
)
controller
.
Ctx
.
ResponseWriter
.
Header
()
.
Set
(
"Access-Control-Allow-Headers"
,
"*"
)
// controller.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Origin", "*")
// controller.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Headers", "*")
logs
.
Info
(
"====>Recv Request:"
,
controller
.
Ctx
.
Input
.
URI
())
if
controller
.
Ctx
.
Input
.
IsPost
()
||
controller
.
Ctx
.
Input
.
IsPut
()
{
...
...
pkg/port/beego/middleware/allow_cors.go
查看文件 @
b8c5533
...
...
@@ -13,7 +13,7 @@ func AllowCors() func(ctx *context.Context) {
//其中Options跨域复杂请求预检
AllowMethods
:
[]
string
{
"*"
},
//指的是允许的Header的种类
AllowHeaders
:
[]
string
{
"Origin"
,
"Authorization"
,
"Access-Control-Allow-Origin"
,
"Content-Type"
},
AllowHeaders
:
[]
string
{
"Origin"
,
"Authorization"
,
"Access-Control-Allow-Origin"
,
"Content-Type"
,
"x-requested-with"
},
//公开的HTTP标头列表
ExposeHeaders
:
[]
string
{
"Content-Length"
,
"Access-Control-Allow-Origin"
,
"Access-Control-Allow-Headers"
,
"Content-Type"
},
//如果设置,则允许共享身份验证凭据,例如cookie
...
...
请
注册
或
登录
后发表评论