-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Suggestion: Exclude routes from MiddlewareBuilder #17 #790
Comments
100% agree 👍 |
Same here, definitely needed that ! |
@alfirin the builder has already been updated and add now the |
Added in |
Any news on this issue? For me it doesn't correct the expected behavior.
We want to have one declaration for all the routes except the ones provided inside the exclude method. Thanks a lot guys. |
Agreed with @alfirin on this. We have the same use case and it doesn't seem to work correctly: consumer
.apply(AuthenticationMiddleware)
.exclude('health')
.forRoutes('*')
|
For your cases, you should rather use either regexp path or |
On v6 of nest, it still does not work. I have same example, and there is no more |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm submitting a...
Current behavior
Nest users have expressed a desire to exclude specific routes from being applied by the middleware consumer. Right now, paths must be hard-coded to exclude routes from being applied. Example: if you want to screen for a JWT in a header for all routes EXCEPT '/auth', there is no way to do so without hard-coding all paths.
Expected behavior
A common solution in #17 was to implement a
MiddlewaresConsumer.exclude()
method, wherein you can specifically exclude a route from consuming a middleware.Example (with v4 syntax, not updated for v5):
What is the motivation / use case for changing the behavior?
This would reduce developer friction, and give them more control over where to apply middlewares.
Environment
The text was updated successfully, but these errors were encountered: