test rewrite middleware