Skip to content

MLE-30494: Support isolated HTTP and XDBC requests#608

Merged
abika5 merged 1 commit into
developfrom
MLE-30494-support-isolation
Jun 26, 2026
Merged

MLE-30494: Support isolated HTTP and XDBC requests#608
abika5 merged 1 commit into
developfrom
MLE-30494-support-isolation

Conversation

@yunzvanessa

Copy link
Copy Markdown
Contributor
  • Support isolated HTTP and XDBC requests by using the new xdmp buitlin xdmp:is-isolated
  • Suport backward compatibility (new mlcp still works with old MarkLogic Server)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates how mlcp detects forwarded/isolated request context when deciding whether to enable host restriction (“HTTP compliant mode”), aiming to support both HTTP and XDBC request types while remaining compatible with older MarkLogic Server versions.

Changes:

  • Centralizes forward-header detection XQuery into ContentOutputFormat.HEADER_QUERY and XDBC_HEADER_QUERY, using fn:function-lookup for backward compatibility.
  • Updates MarkLogicInputFormat to evaluate both HTTP and XDBC forward-header checks and enable host restriction if either is true.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/main/java/com/marklogic/mapreduce/MarkLogicInputFormat.java Uses shared header-detection XQuery constants and combines HTTP/XDBC forward-header results to decide whether to restrict hosts.
src/main/java/com/marklogic/mapreduce/ContentOutputFormat.java Implements backward-compatible XQuery snippets for detecting forwarded requests for both HTTP and XDBC contexts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +131 to +138
"let $f := fn:function-lookup(xs:QName('xdmp:is-forwarded'),0)\n" +
"return if (exists($f)) then $f() " +
"else fn:exists(xdmp:get-request-header('x-forwarded-for'))";
// For XDBC Server
public static final String XDBC_HEADER_QUERY =
"let $f := fn:function-lookup(xs:QName('xdmp:is-forwarded'),0)\n" +
"return if (exists($f)) then $f() " +
"else (" +
Comment on lines 403 to +407
if (getForwardHeader) {
forwardHeaderExists = item.asString().equals("true");
item = result.next();
forwardHeaderExists |= item.asString().equals("true");
item = result.next();

@abika5 abika5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@abika5 abika5 merged commit f328eec into develop Jun 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants