Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
c30d7ab8
Commit
c30d7ab8
authored
Feb 04, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update cors middleware
parent
ab4a670b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
11 deletions
+2
-11
server.go
server/server.go
+2
-11
No files found.
server/server.go
View file @
c30d7ab8
...
@@ -56,12 +56,6 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
...
@@ -56,12 +56,6 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
`"status":${status},"error":"${error}"}`
+
"
\n
"
,
`"status":${status},"error":"${error}"}`
+
"
\n
"
,
}))
}))
e
.
Use
(
middleware
.
CORSWithConfig
(
middleware
.
CORSConfig
{
Skipper
:
grpcRequestSkipper
,
AllowOrigins
:
[]
string
{
"*"
},
AllowMethods
:
[]
string
{
http
.
MethodGet
,
http
.
MethodHead
,
http
.
MethodPut
,
http
.
MethodPatch
,
http
.
MethodPost
,
http
.
MethodDelete
},
}))
e
.
Use
(
CORSMiddleware
())
e
.
Use
(
CORSMiddleware
())
e
.
Use
(
middleware
.
TimeoutWithConfig
(
middleware
.
TimeoutConfig
{
e
.
Use
(
middleware
.
TimeoutWithConfig
(
middleware
.
TimeoutConfig
{
...
@@ -198,7 +192,7 @@ func CORSMiddleware() echo.MiddlewareFunc {
...
@@ -198,7 +192,7 @@ func CORSMiddleware() echo.MiddlewareFunc {
w
:=
c
.
Response
()
.
Writer
w
:=
c
.
Response
()
.
Writer
w
.
Header
()
.
Set
(
"Access-Control-Allow-Origin"
,
r
.
Header
.
Get
(
"Origin"
))
w
.
Header
()
.
Set
(
"Access-Control-Allow-Origin"
,
r
.
Header
.
Get
(
"Origin"
))
w
.
Header
()
.
Set
(
"Access-Control-Allow-Methods"
,
"GET, POST, PUT, DELETE, OPTIONS"
)
w
.
Header
()
.
Set
(
"Access-Control-Allow-Methods"
,
"GET, POST, PUT, DELETE,
PATCH,
OPTIONS"
)
w
.
Header
()
.
Set
(
"Access-Control-Allow-Headers"
,
"Content-Type, Authorization"
)
w
.
Header
()
.
Set
(
"Access-Control-Allow-Headers"
,
"Content-Type, Authorization"
)
w
.
Header
()
.
Set
(
"Access-Control-Allow-Credentials"
,
"true"
)
w
.
Header
()
.
Set
(
"Access-Control-Allow-Credentials"
,
"true"
)
...
@@ -207,10 +201,7 @@ func CORSMiddleware() echo.MiddlewareFunc {
...
@@ -207,10 +201,7 @@ func CORSMiddleware() echo.MiddlewareFunc {
w
.
WriteHeader
(
http
.
StatusOK
)
w
.
WriteHeader
(
http
.
StatusOK
)
return
nil
return
nil
}
}
return
next
(
c
)
// Continue processing request.
next
(
c
)
return
nil
}
}
}
}
}
}
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