# Proxy\_pass and rewrite

**URL:** <https://www.ruby-forum.com/t/proxy-pass-and-rewrite/236150>\
**Category:** NGINX\
**Created:** [August 9, 2013, 8:01pm UTC](https://www.ruby-forum.com/t/proxy-pass-and-rewrite/236150 "2013-08-09T20:01:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [August 9, 2013, 8:01pm UTC](https://www.ruby-forum.com/t/proxy-pass-and-rewrite/236150/1 "2013-08-09T20:01:03Z")

</div>

Hi, I’m try to do a proxy\_pass and rewrite rules like this:

location /directory/ {  
proxy\_pass http://some\_url\_to\_proxy\_pass/;  
expires +10d;  
}

It’s working, but I need to repeat the /directory/ on the new url to  
work  
…like this  
[http://testurl.com/directory/directory/foo/bar/](http://testurl.com/directory/directory/foo/bar/)

And I want just one /directory/foo/bar/…then a try a rewrite rule,  
like  
this

location /directory/ {  
proxy\_pass http://some\_url\_to\_proxy\_pass/;  
rewrite /directory/(.\*) $1 break;  
expires +10d;  
}

But, isn’t work  
Some help, please.  
Thanks
