code: public static String getRemoteAddr(final HttpServletRequest request) {
          String ret = request.getHeader("X-forwarded-for");
          if (StringUtils.isBlank(ret)) {
              ret = request.getHeader("X-Real-IP");
          }
          if (StringUtils.isBlank(ret)) {
              return request.getRemoteAddr();
          }
  
          return ret.split(",")[0];
      }
docs: Gets the Internet Protocol (IP) address of the end-client that sent the specified request.
  <p>
  It will try to get HTTP head "X-forwarded-for" or "X-Real-IP" from the last proxy to get the request first, if not found, try to get
  it directly by {@link HttpServletRequest#getRemoteAddr()}.
  </p>
  
  @param request the specified request
  @return the IP address of the end-client sent the specified request