ProxyPassMatch和ProxyPass - 高飞鸟 - Highbird高飞鸟 �C Highbird
Apache2中的反向代理有以下2个指令:
1.ProxyPass:
ProxyPass [path] !|url
它主要是用作URL前缀匹配,不能有正则表达式,它里面配置的Path实际上是一个虚拟的路径,在反向代理到后端的url后,path是不会带过去的。
Suppose the local server has address http://example.com/; then
will cause a local request for http://example.com/mirror/foo/bar to be internally converted into a proxy request to http://backend.example.com/bar.
在nginx中与之对应的指令是
2.ProxyPassMatch:
ProxyPassMatch [regex] !|url
它实际上是url正则匹配,匹配上的regex部分是会带到后端的url的。
This directive is equivalent to ProxyPass, but makes use of regular expressions, instead of simple prefix matching. The supplied regular expression is matched against the url, and if it matches, the server will substitute any parenthesized matches into the given string and use it as a new url.
Suppose the local server has address http://example.com/; then
will cause a local request for http://example.com/foo/bar.gif to be internally converted into a proxy request to http://backend.example.com/foo/bar.gif.
在nginx中与之对应的指令是
它一般和ProxyPass指令配合使用,
此指令使Apache调整HTTP重定向应答中Location
, Content-Location
, URI
头里的URL
这样可以避免在Apache作为反向代理使用时,后端服务器的HTTP重定向造成的绕过反向代理的问题
Read full article from ProxyPassMatch和ProxyPass - 高飞鸟 - Highbird高飞鸟 �C Highbird
No comments:
Post a Comment