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
a09c6698
Unverified
Commit
a09c6698
authored
Jun 21, 2024
by
Ryo
Committed by
GitHub
Jun 21, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: allow cors for grpc gateway handler (#3574)
parent
75933799
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
v1.go
server/router/api/v1/v1.go
+7
-2
No files found.
server/router/api/v1/v1.go
View file @
a09c6698
...
...
@@ -7,6 +7,7 @@ import (
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/improbable-eng/grpc-web/go/grpcweb"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/reflection"
...
...
@@ -104,8 +105,12 @@ func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Ech
if
err
:=
v1pb
.
RegisterIdentityProviderServiceHandler
(
ctx
,
gwMux
,
conn
);
err
!=
nil
{
return
err
}
echoServer
.
Any
(
"/api/v1/*"
,
echo
.
WrapHandler
(
gwMux
))
echoServer
.
Any
(
"/file/*"
,
echo
.
WrapHandler
(
gwMux
))
gwGroup
:=
echoServer
.
Group
(
""
)
gwGroup
.
Use
(
middleware
.
CORS
())
handler
:=
echo
.
WrapHandler
(
gwMux
)
gwGroup
.
Any
(
"/api/v1/*"
,
handler
)
gwGroup
.
Any
(
"/file/*"
,
handler
)
// GRPC web proxy.
options
:=
[]
grpcweb
.
Option
{
...
...
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