Skip to content

improve api gateway cors - #247

Merged
raylrui merged 2 commits into
mainfrom
feat/improve-api-gateway-cors
Jun 11, 2026
Merged

improve api gateway cors#247
raylrui merged 2 commits into
mainfrom
feat/improve-api-gateway-cors

Conversation

@raylrui

@raylrui raylrui commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolve issue #246

Make OrcaBusApiGateway CORS configuration more extensible for service-specific API requirements.

This PR adds:

  • optional corsAllowHeaders
  • optional corsExposeHeaders
  • PUT to the default CORS allowed methods

Changes

  • Added corsAllowHeaders?: string[] to OrcaBusApiGatewayProps
  • Added corsExposeHeaders?: string[] to OrcaBusApiGatewayProps
  • Appended props.corsAllowHeaders to the default CORS allowHeaders
  • Added CorsHttpMethod.PUT to default CORS allowMethods
  • Passed props.corsExposeHeaders to corsPreflight.exposeHeaders

Compatibility

Existing services keep the same default CORS behavior unless they opt in to the new props.

corsAllowOrigins behavior is unchanged.

@raylrui raylrui self-assigned this Jun 10, 2026
@raylrui raylrui added the enhancement New feature or request label Jun 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the OrcaBusApiGateway construct to make API Gateway HTTP API CORS configuration more extensible, addressing #246 while preserving existing default behavior unless consumers opt in.

Changes:

  • Added optional corsAllowHeaders?: string[] and corsExposeHeaders?: string[] to OrcaBusApiGatewayProps.
  • Extended the default CORS configuration to include PUT and to append any additional allowed request headers.
  • Wired corsExposeHeaders through to corsPreflight.exposeHeaders and updated generated docs accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/api-gateway/api-gateway.ts Adds new optional CORS props and applies them to HttpApi CORS preflight config (extra allow headers, PUT method, expose headers).
packages/docs/@orcabus/namespaces/apigateway/interfaces/OrcaBusApiGatewayProps.md Updates generated interface docs to include the two new optional CORS props.
packages/docs/@orcabus/namespaces/apigateway/classes/OrcaBusApiGateway.md Updates generated class docs to reflect source line shifts from the code change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@raylrui
raylrui added this pull request to the merge queue Jun 11, 2026
Merged via the queue into main with commit fb0fa11 Jun 11, 2026
6 checks passed
@raylrui
raylrui deleted the feat/improve-api-gateway-cors branch June 11, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants