# Proxy

**URL:** <https://www.ruby-forum.com/t/proxy/243750>\
**Category:** NGINX\
**Created:** [December 30, 2015, 7:51am UTC](https://www.ruby-forum.com/t/proxy/243750 "2015-12-30T07:51:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [December 30, 2015, 7:51am UTC](https://www.ruby-forum.com/t/proxy/243750/1 "2015-12-30T07:51:13Z")

</div>

In my local machine browser, I want to open [http://localhost/abc](http://localhost/abc) to  
proxy a real [http://www.abc.com/](http://www.abc.com/) as well as proxying all child resources  
such as

[http://localhost/abc/bcd/a.html](http://localhost/abc/bcd/a.html) to proxy [http://www.abc.com/bcd/a.html](http://www.abc.com/bcd/a.html)  
[http://localhost/abc/bc.html](http://localhost/abc/bc.html) to proxy [http://www.abc.com/bc.html](http://www.abc.com/bc.html)  
…

How do I perform it?

Jim

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 30, 2015, 6:30pm UTC](https://www.ruby-forum.com/t/proxy/243750/2 "2015-12-30T18:30:54Z")

</div>

On Wed, Dec 30, 2015 at 02:50:24PM +0800, 天河石 - 谢金鹏 wrote:

Hi there,

> In my local machine browser, I want to open [http://localhost/abc](http://localhost/abc) to proxy a real  
> [http://www.abc.com/](http://www.abc.com/) as well as proxying all child resources such as
> 
> [http://localhost/abc/bcd/a.html](http://localhost/abc/bcd/a.html) to proxy [http://www.abc.com/bcd/a.html](http://www.abc.com/bcd/a.html)  
> [http://localhost/abc/bc.html](http://localhost/abc/bc.html) to proxy [http://www.abc.com/bc.html](http://www.abc.com/bc.html)  
> …
> 
> How do I perform it?

proxy\_pass ([Module ngx\_http\_proxy\_module](http://nginx.org/r/proxy_pass)).

You should reverse-proxy to a server that you control.

Making things work where the url hierarchies differ – /abc/ in nginx  
being the same as / in the upstream server – can be difficult. But  
sometimes it works.

# == location ^~ /abc/ { proxy\_pass [http://www.abc.com/](http://www.abc.com/); }

and then try accessing [http://localhost/abc/bc.html](http://localhost/abc/bc.html) and see what you  
get back.

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
