falconry / falcon

The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
https://falcon.readthedocs.io/en/stable/
Apache License 2.0
9.52k stars 946 forks source link

feat: Override middleware configuration for a certain route, sink, or static route #1258

Open kgriffs opened 6 years ago

kgriffs commented 6 years ago

Example use case: Implement a health check endpoint that excludes an auth middleware but retains middleware that adds a trace id to req.context.

kgriffs commented 6 years ago

Another use case from @adsahay_twitter on Gitter:

Is it possible to assign different set of middleware for different paths/resources? For instance - while normally our JSON API expects an API key, there are certain callback urls where other services redirect to our url upon completing a transaction - and they do a simple redirect without API key. Therefore, these endpoints do not need the middleware that checks for valid API keys.

First instinct - use "ResourceGroups" (list of Resources) and apply middleware to them, which overrides app.middleware.

dmvass commented 6 years ago

Hello @kgriffs, I think that a functionality to handle a process_request before routing will be broken. Do you have any good idea how to resolve this issue?