Proxy

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?

Jim

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 (Module ngx_http_proxy_module).

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 D. [email protected]