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

Allow request handlers to individually disable cors #332

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

peterfaria-jitb
Copy link

I'm submitting this as a Draft PR to gather feedback on my approach.
I'm trying to allow routes to individually enable or disable CORS.
My team finds this useful for creating an API where not all routes
are desirable to be called from a browser.

My proposal is to allow a configuration option, cors: boolean.

Example usage:

  fastify.get<{  }, { cors: boolean }>(
    '/v1/foo/bar',
    {
      config: {
        cors: false,
      },
    },

Checklist

@mcollina
Copy link
Member

This works.

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.

2 participants