MarkLogic HTTP Server:设置CORS标头

Kri*_*nya 5 ajax web-development-server marklogic cors

我正在MarkLogic 7CentOS 6.5 box.我的HTML/JS应用程序托管在同一台机器上的MarkLogic HTTP服务器上.应用程序在端口8003上运行,需要通过REST API在不同的端口8007上运行来访问数据.当我AJAX在我的应用程序中使用请求时,我收到错误说

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://172.16.100.104:8003' is therefore not allowed access.  
Run Code Online (Sandbox Code Playgroud)

有没有人设置MarkLogicCORS早?任何帮助都会很棒.

mbl*_*ele 3

您可以使用https://docs.marklogic.com/xdmp:add-response-header设置Access-Control-Allow-Origin标头。您必须为每个需要使用跨站点请求的端点执行此操作:https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS有详细信息。