Loading TOC...


   $name as xs:string,
   [$default as xs:string?]
) as xs:string*


Returns the value of a named request header.

$name Request header name.
$default A default value to return if there is no request header.


=> "foo"

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


The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • Are header names case-sensitive?
  • This isn't totally obvious, but if you want to get the name of the server you can use xdmp:get-request-header("Host")
    • The Host header will have the name of the Host from the client (aka browser aka user agent) perspective. That is, it will have the hostname that was in the URL, which may, or may not, be what you want.
      • Exactly what I wanted and something I suspect others will want, too.
        • FYI the Host header may not come with HTTP/1.0 requests. It was added in HTTP/1.1.