Skip to content

Commit

Permalink
fix: CORS errors with additional headers in local dev (#3379)
Browse files Browse the repository at this point in the history
Fixes #3378
  • Loading branch information
wesbillman authored Nov 13, 2024
1 parent b66fe24 commit 86b4cf0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/controller/timeline/events_ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (s *Service) insertHTTPIngress(ctx context.Context, querier sql.Querier, in
return fmt.Errorf("failed to encrypt ingress payload: %w", err)
}

log.FromContext(ctx).Warnf("Inserting ingress event for %s %s", ingress.RequestKey, ingress.Path)
log.FromContext(ctx).Debugf("Inserting ingress event for %s %s", ingress.RequestKey, ingress.Path)

err = libdal.TranslatePGError(querier.InsertTimelineIngressEvent(ctx, sql.InsertTimelineIngressEventParams{
DeploymentKey: ingress.DeploymentKey,
Expand Down
5 changes: 5 additions & 0 deletions frontend/cli/cmd_serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ func (s *serveCmd) run(
s.CommonConfig.AllowOrigins = append(s.CommonConfig.AllowOrigins, addr)
}

if devMode && len(s.CommonConfig.AllowHeaders) == 0 {
// Default to allowing all headers for console requests in local dev mode.
s.CommonConfig.AllowHeaders = []string{"*"}
}

provisionerAddresses := make([]*url.URL, 0, s.Provisioners)
for range s.Provisioners {
bind, err := bindAllocator.Next()
Expand Down
2 changes: 1 addition & 1 deletion frontend/console/src/features/verbs/VerbRequestForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const VerbRequestForm = ({ module, verb }: { module?: Module; verb?: Verb
}
}, [verb, bodyTextKey])

const bottomText = response ?? error ?? ''
const bottomText = response || error || ''
const schemaString = verb ? JSON.stringify(simpleJsonSchema(verb)) : ''

return (
Expand Down

0 comments on commit 86b4cf0

Please sign in to comment.