Your nginx reverse proxy setup shouldn't redirect to 10000 unless you have a special proxy_redirect directive that tells nginx to do so otherwise. Something else is doing that.
Because your server block only listens on port 80. So your condition
$http_host != "cp.domain.com:10000"
will always be true because the port part of $http_host is always 80. That's how the redirect loop occurs. Basically that if block is useless here.