Skip to content

feat: add per-endpoint CORS override configuration#168

Closed
Uchechukwu-Ekezie wants to merge 1 commit into
accesslayerorg:mainfrom
OpenSourceCOntr:feat/per-endpoint-cors-override-159
Closed

feat: add per-endpoint CORS override configuration#168
Uchechukwu-Ekezie wants to merge 1 commit into
accesslayerorg:mainfrom
OpenSourceCOntr:feat/per-endpoint-cors-override-159

Conversation

@Uchechukwu-Ekezie
Copy link
Copy Markdown
Contributor

Fixes #159

What changed

  • Exported corsOverride(options) factory from cors.middleware.ts
  • Merges per-route CorsOptions on top of global defaults (allowedOrigins + credentials: true)
  • Global corsMiddleware() and all existing routes are unchanged
  • JSDoc examples show webhook and export-headers use-cases

Why

Some routes (public webhooks, file exports, partner integrations) need a different CORS policy than the app default. The override merges only what you specify so secure defaults are never accidentally dropped.

How to test

  1. Import corsOverride on any route and pass custom options (e.g. { origin: '*', credentials: false })
  2. OPTIONS preflight on that route should reflect the override
  3. All other routes should still use the global allowed-origins policy

- Export corsOverride() factory that merges per-route CorsOptions on top
  of the global defaults (allowedOrigins + credentials: true)
- Global corsMiddleware() is unchanged — only routes that opt in are affected
- JSDoc examples show webhook and export use-cases

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 25, 2026

@Uchechukwu-Ekezie Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add per-endpoint CORS override configuration

1 participant