xdmp:get-request-header("X-Forwarded-For") ought to do it (if the HTTP server 
is 
creating a header with just that spelling; that's what Apache does).

We have a function we use to determine the actual source IP address that you 
might be able to use or adapt:

(:~
  : Ascertain IP address masked by Apache rewrites.
  :
  : @return The actual client address.
  :)

declare function user:get-actual-client-address() as xs:string {
   let $apparentIP := xdmp:get-request-client-address()
   let $forwardedFrom := xdmp:get-request-header("X-Forwarded-For")
   return
     if ((exists($forwardedFrom)) and ($apparentIP eq '127.0.0.1'))
     then tokenize($forwardedFrom, ', ')[last()]
     else $apparentIP
};

David

On Fri, 5 Jun 2015, Danny Sinang wrote:

> Our ML cluster is behind a load balancer, so the source ip address of the
> ML access logs show the load balancer's IP address.
>
> I'm told that the load balancer injects into the http request header the
> actual client ip address as "x-forwarded-for".
>
> Is there a way to make ML display the contents of this x-forwarded-for
> field ?
>
> Regards,
> Danny
>

-- 
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 400314, Charlottesville, VA 22904-4314 USA
Email: [email protected]   Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to