1 Reply Latest reply on Jun 27, 2018 9:00 PM by Stephan van Beerschoten

    Loadbalanced WildFly 8.2.1: no client ip in access.log

    Stephan van Beerschoten Newbie

      How do I configure WildFly so it will put the real client ip address in the access.log file?

       

      My load balancer sets x-forwarded-for, and calls to request.getRemoteAddr() give me the correct ip address.

      The only thing consistently logging the address of the load balancer instead of the real client ip is my access.log file.

       

      I have configured WildFly like this:

       

      <server name="default-server">

                      <ajp-listener name="ajp" socket-binding="ajp"/>

                      <http-listener name="default" socket-binding="http" proxy-address-forwarding="true"/>

                      <host name="default-host" alias="localhost">

                          <location name="/" handler="welcome-content"/>

                          <access-log pattern="common" directory="${jboss.server.log.dir}" prefix="access"/>

                          <filter-ref name="server-header"/>

                          <filter-ref name="x-powered-by-header"/>

                      </host>

                  </server>

       

      What am I missing?

        • 1. Re: Loadbalanced WildFly 8.2.1: no client ip in access.log
          Stephan van Beerschoten Newbie

          I figured out that the problem was the log pattern. The "common" pattern doesn't pick up the actual client IP address in this behind-a-loadbalancer situation.

          The following pattern replicates the "common" pattern, but properly inserts the client IP address using pattern element %a:

           

          pattern='%a %l %u %t "%r" %s %b'

          Mind the use of single and double quotes, as the %r parameter (first line of http request) is quoted in the common log pattern.

           

          Also, the "proxy-address-forwarding="true"" parameter in the http-listener element is not necessary.