Loading TOC...

MarkLogic 12 EA 1 Product Documentation
xdmp:get-request-client-address

xdmp:get-request-client-address() as xs:string?

Summary

Returns as a string the internet address of the client from which the HTTP server request is issued.

Returns the empty sequence if it is not called from an HTTP server.

Usage Notes

Use this function if you need to get the internet protocol (IP) address of the requesting client. For example, you can create an application that contains conditional code based on IP addresses (see the example below).

Example

The following example shows logic which checks if the request was submitted from the "localhost" IP address (127.0.0.1).

  if (xdmp:get-request-client-address() eq "127.0.0.1")
  then "Submitted from localhost."
  else "Only localhost access is allowed for this application."

Example

xdmp:get-request-client-address()
=> "127.0.0.1"

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.