Need to proxy pass and rewrite the url

my conf :

location / {
proxy_pass http://mydomain.com;
proxy_redirect off;
proxy_set_header Host $host;
}

location ~*/redirect {
    proxy_pass           http://some.domain.com/cp/$1;
}

But with above config not working giving me following error page
“The page you are looking for is temporarily unavailable. Please try
again later.”

Referred the below thread:
Nginx for proxy + rewrite - NGINX - Ruby-Forum
This almost clear my problem but need to append cp to the url?

On 20 Jan 2012 10h04 WET, [email protected] wrote:

}

This makes no sense. What do you want to capture in $1?

— appa