apache ProxyPass: how to preserve original IP address

前端 未结 5 731
执念已碎
执念已碎 2020-12-02 12:22

We are using ProxyPass to redirect all \"/r\" requests to jboss on port 18080 as follows:

ProxyPreserveHost on
ProxyPass /r http://localhost:18080/redirectSe         


        
5条回答
  •  爱一瞬间的悲伤
    2020-12-02 13:08

    The answer of JasonW is fine. But since apache httpd 2.4.6 there is a alternative: mod_remoteip

    All what you must do is:

    1. May be you must install the mod_remoteip package
    2. Enable the module:

      LoadModule remoteip_module modules/mod_remoteip.so
      
    3. Add the following to your apache httpd config. Note that you must add this line not into the configuration of the proxy server. You must add this to the configuration of the proxy target httpd server (the server behind the proxy):

      RemoteIPHeader X-Forwarded-For
      

    See at http://httpd.apache.org/docs/trunk/mod/mod_remoteip.html for more informations and more options.

提交回复
热议问题