Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add CORS examples #62439

Merged
merged 4 commits into from
Feb 23, 2024
Merged

Docs: Add CORS examples #62439

merged 4 commits into from
Feb 23, 2024

Conversation

delbaoliveira
Copy link
Contributor

@delbaoliveira delbaoliveira commented Feb 23, 2024

Show how to set CORS headers in:

  • Route Handlers (Single Endpoints)
  • Middleware (Multiple Endpoints, Origins, Simple and Preflighted Requests)
  • next.config.js (Multiple Endpoints)

@delbaoliveira delbaoliveira requested review from a team as code owners February 23, 2024 11:18
@delbaoliveira delbaoliveira requested review from timeyoutakeit and leerob and removed request for a team February 23, 2024 11:18
const origin = request.headers.get('origin') ?? ''
const isAllowedOrigin = allowedOrigins.includes(origin)

// Handle preflighted requests
Copy link
Member

Choose a reason for hiding this comment

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

Have we used this "preflight" terminology elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We link to the MDN docs explanation in the paragraph above. This is mostly for those using the OPTIONS method.

@manovotny manovotny merged commit 01c1bfa into canary Feb 23, 2024
32 checks passed
@manovotny manovotny deleted the docs-8gjs branch February 23, 2024 15:11
@github-actions github-actions bot added the locked label Mar 9, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants