middleware rewrite specs