Actix-web: Middleware should allow configuring per resource

Created on 13 Aug 2018  路  2Comments  路  Source: actix/actix-web

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.

All 2 comments

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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

djc picture djc  路  3Comments

icommit picture icommit  路  3Comments

naturallymitchell picture naturallymitchell  路  4Comments

uncotion picture uncotion  路  3Comments

zhaobingss picture zhaobingss  路  4Comments