rewrite of haproxy to nginx with rp func