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

Ability to customize OPTIONS auto-response and its middleware per group #136

Closed
samdark opened this issue Dec 8, 2021 · 0 comments
Closed

Comments

@samdark
Copy link
Member

samdark commented Dec 8, 2021

What

We need ability to customize OPTIONS auto-response per group:

$group = Group::create('/v1')
  ->withAutoOptions(MyCustomMiddleware::class, CorsMiddleware::class)
  ->routes(...)

How

A group should add new OPTIONS route with the middleware specified for each unique pattern.

Why?

The use case is the following.

  1. We have an API with /v1/** and /v2/** endpoint groups and want to apply different CORS middleware to both.
  2. The rest of URLs should respond with default OPTIONS with all the methods available.

Additionally

Remove ability to disable auto-OPTIONS in router. Either it's sane defaults or using your own middleware.

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

No branches or pull requests

1 participant