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

Middleware should allow configuring per resource #466

Closed
chefsalim opened this issue Aug 13, 2018 · 3 comments
Closed

Middleware should allow configuring per resource #466

chefsalim opened this issue Aug 13, 2018 · 3 comments

Comments

@chefsalim
Copy link

One of the things that we are missing coming from Iron is the ability to set middleware on a per resource level. For example, we have Authenticated middleware that we'd like to set only on the authenticated resources. Currently, actix-web does not allow this, so we have to either not use middleware for auth, or try to hack around in less than elegant ways. It would be great to have this ability, or some other supported pattern.

@fafhrd91
Copy link
Member

You can set middleware per resource. It is not possible to use middlewares on route level

https://actix.rs/actix-web/actix_web/dev/struct.Resource.html#method.middleware

@chefsalim
Copy link
Author

Thanks @fafhrd91 .. apologies for missing the resource level middleware in the doc. I'm trying this out, unfortunately running into another blocking issue that I will post separately.

@lermana
Copy link

lermana commented Mar 23, 2023

FYI middleware at route level is now supported as well: #2725

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

3 participants