proxy

Francis Daly francis at daoine.org
Wed Dec 30 17:30:16 UTC 2015


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 to proxy a real http://www.abc.com/ as well as proxying all child resources such as
> 
> 
> http://localhost/abc/bcd/a.html to proxy http://www.abc.com/bcd/a.html 
> http://localhost/abc/bc.html to proxy http://www.abc.com/bc.html 
> ...
> 
> 
> How do I perform it?

proxy_pass (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/;
  }
==

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

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list