Meaning of the PROXYPASSREVERSE directive in Apache configuration

Source: Internet
Author: User


The main function of the Mod_proxy module in Apache is to forward the URL, which is the function of the agent. With this feature, it is convenient to realize the integration with the application server such as Tomcat, which can easily realize the function of the Web cluster.

For example, using Apache as the domain name www.test.com Proxy Server, exposing it to the public network, that is, DNS resolution to this machine, the real Web server is another one located in the same intranet machine, assuming the IP is 192.168.100.22, then only need the following configuration is possible.

proxypass/http://192.168.100.22/
proxypassreverse/http://192.168.100.22/

Proxypass is well understood, that is, all requests from the client to http://www.test.com are forwarded to the http://192.168.100.22 for processing, proxypassreverse configuration is always consistent with Proxypass , but the use is puzzling. Seems to get rid of it is very good work, the fact is true, actually, if there are 302 redirects in response, Proxypassreverse will come in handy. For example, suppose the user accesses the http://www.test.com/exam.php and forwards it to http://192.168.100.22/ exam.php processing, assuming that the result of exam.php processing is to implement redirect to login.php (using relative paths, that is, omitting the domain name information), if the reverse proxy is not configured, the client receives a request response that is a redirect operation, and the redirect destination URL is http:/ /192.168.100.22/login.php, and this address is only the proxy server can be accessed, it is conceivable that the client is not open, and conversely if the reverse proxy is configured, it will be transferred to the HTTP redirect before forwarding to the client. Www.test.com/login.php, which is the redirect path appended to the original request. When the client requests http://www.test.com/login.php again, the proxy server works again to forward it to http://192.168.100.22/login.php.

The client-to-server is called a forward proxy, and the server to the client is called a reverse proxy.

The above describes the Apache configuration of the meaning of the Proxypassreverse directive, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.