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

Change middleware registration order #2796

5 changes: 4 additions & 1 deletion aries_cloudagent/admin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def _matches_additional_routes(self, path: str) -> bool:
async def make_application(self) -> web.Application:
"""Get the aiohttp application instance."""

middlewares = [ready_middleware, debug_middleware, validation_middleware]
middlewares = [ready_middleware, debug_middleware]

# admin-token and admin-token are mutually exclusive and required.
# This should be enforced during parameter parsing but to be sure,
Expand Down Expand Up @@ -453,6 +453,9 @@ async def setup_context(request: web.Request, handler):

middlewares.append(setup_context)

# Register validation_middleware last avoiding unauthorized validations
middlewares.append(validation_middleware)

app = web.Application(
middlewares=middlewares,
client_max_size=(
Expand Down