added rewriteRequest