Revert "Middleware no longer needed"

This reverts commit 38c7769b706908679d284ace319ec9b92f542e85.
Middleware is actually still needed