Convert frame guard to middleware.