# Need to proxy pass and rewrite the url

**URL:** <https://www.ruby-forum.com/t/need-to-proxy-pass-and-rewrite-the-url/215952>\
**Category:** NGINX\
**Created:** [January 20, 2012, 11:04am UTC](https://www.ruby-forum.com/t/need-to-proxy-pass-and-rewrite-the-url/215952 "2012-01-20T11:04:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 20, 2012, 11:04am UTC](https://www.ruby-forum.com/t/need-to-proxy-pass-and-rewrite-the-url/215952/1 "2012-01-20T11:04:20Z")

</div>

my conf :

location / {  
proxy\_pass [http://mydomain.com](http://mydomain.com);  
proxy\_redirect off;  
proxy\_set\_header Host $host;  
}

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

```

- [http://mydomain.com/12121/redirect](http://mydomain.com/12121/redirect) --\>\>  
[http://some.domain.com/cp/redirect](http://some.domain.com/cp/redirect)

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](http://www.ruby-forum.com/topic/144179)  
This almost clear my problem but need to append cp to the url?

---

<div class="post-metadata">

**Author:** ![kamalakar\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a8b319/32.png) [@kamalakar\_v](https://www.ruby-forum.com/u/kamalakar_v)\
**Post date:** [January 20, 2012, 3:25pm UTC](https://www.ruby-forum.com/t/need-to-proxy-pass-and-rewrite-the-url/215952/2 "2012-01-20T15:25:18Z")

</div>

On 20 Jan 2012 10h04 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> }

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

— appa
