Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
search_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
741596fa
authored
Feb 02, 2023
by
SUDPTDUBLXEROFX\Administrator
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
跨域
parent
c4afff33
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
pkg/common/response.go
pkg/common/response.go
View file @
741596fa
...
...
@@ -65,6 +65,9 @@ func Output(ctx *gin.Context, errCode int, errMsg string, data interface{}) {
referer
=
strings
.
TrimRight
(
referer
,
"/"
)
ctx
.
Header
(
"Access-Control-Allow-Origin"
,
referer
)
ctx
.
Header
(
"Access-Control-Allow-Credentials"
,
"true"
)
ctx
.
Header
(
"Access-Control-Allow-Headers"
,
"*"
)
ctx
.
Header
(
"Access-Control-Allow-Methods"
,
"GET,HEAD,POST,PUT,DELETE,OPTIONS"
)
ctx
.
Header
(
"Access-Control-Expose-Headers"
,
"Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type"
)
//允许跨站访问的站点域名
//跨域请求头设置
ctx
.
JSON
(
200
,
response
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment