我在运行 MarkLogic 7
在 CentOS 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.
有没有人设置过
MarkLogic
为 CORS
更早?任何帮助都会很棒。
最佳答案
您可以使用 https://docs.marklogic.com/xdmp:add-response-header设置 Access-Control-Allow-Origin
标题。您必须为需要使用跨站点请求的每个端点执行此操作:https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS有详细信息。
关于ajax - MarkLogic HTTP 服务器 : Set up CORS headers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24270088/