Setup layout middleware