Updates for the rewrite middleware

- Fixed middleware instantiation process.
- Use `RawURL()` instead of `URL.String()` method.