refine middleware page