Just a note for anyone using MarkLogic URL rewriting.

A typical MarkLogic URL rewrite script for an HTTP server looks like this in 
pseudo-code:

let $URL := xdmp:get-request-url()
return
   if (matches($URL, something)) then replace($URL, regex, replacement)
   . . .
   else $URL

It turns out that if an HTTP client is ill-behaved and sends an empty HTTP GET 
request (you can simulate this using telnet to the server port), it triggers a 
500 error in MarkLogic: XDMP-RETURNTYPE complaining that the rewrite script is 
not returning a string. This means that one's rewrite script needs explicitly 
to 
handle null URLs, for example

   if (empty($URL) or $URL eq '') then [some replacement]

"some replacement" should probably be the root document of the server, e.g. 
/default.xqy (at any rate that's what Apache serves up in the same situation).

Possibly MarkLogic should itself handle an empty return value from the rewrite 
script without throwing an error.

DS

-- 
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]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to