Added UrlEncode to params when rewriting the request. See issue #318