Skip to content

Commit

Permalink
Merge branch 'develop' into feat/issues/1849
Browse files Browse the repository at this point in the history
  • Loading branch information
shivanshuraj1333 authored Oct 17, 2024
2 parents a95eb47 + 337a941 commit 830b7f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion ee/query-service/app/api/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ import (

func (ah *APIHandler) ServeGatewayHTTP(rw http.ResponseWriter, req *http.Request) {
ctx := req.Context()
if !strings.HasPrefix(req.URL.Path, gateway.RoutePrefix+gateway.AllowedPrefix) {
validPath := false
for _, allowedPrefix := range gateway.AllowedPrefix {
if strings.HasPrefix(req.URL.Path, gateway.RoutePrefix+allowedPrefix) {
validPath = true
break
}
}

if !validPath {
rw.WriteHeader(http.StatusNotFound)
return
}
Expand Down
4 changes: 2 additions & 2 deletions ee/query-service/integrations/gateway/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"strings"
)

const (
var (
RoutePrefix string = "/api/gateway"
AllowedPrefix string = "/v1/workspaces/me"
AllowedPrefix []string = []string{"/v1/workspaces/me", "/v2/profiles/me"}
)

type proxy struct {
Expand Down

0 comments on commit 830b7f1

Please sign in to comment.