Update: I have turned on rewrite log. The rewrite log shows uglyID correctly matched and sent to proxy unencoded. However in TCP dump, I can see that it was re-encoded again. Also on the target server, I can see the incoming request having uglyID re-encoded again.