Common middleware.