Skip to content

Starlette - Multiple middleware orders #2278

Closed Answered by Kludex
4sushi asked this question in Potential Issue
Discussion options

You must be logged in to vote

[...] it's just a misunderstanding on my side.

Yes.

The idea is that each middleware you add wraps the current application. So... If you have an app A, and you add the middleware B, you now have B(A), which is now another application. When you add a middleware C, conceptually you should think that you have the B(A) application, and not only A. Meaning that you'll have the C(B(A)) application from now on.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@4sushi
Comment options

Answer selected by Kludex
Comment options

You must be logged in to vote
1 reply
@Kludex
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants