Hi Sateesh, Instead of trying to add CORS headers, I’d advice solving it differently. It should not be difficult to make all traffic go through one server. Put a simple proxying tier in front that proxies /v1/ to MarkLogic, and serves anything else as static files.
The MarkLogic Slush template uses NodeJS for that purpose: https://github.com/marklogic/slush-marklogic-node Cheers, Geert From: SateeshKumar Bheemsetty <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Tuesday, March 31, 2015 at 4:23 AM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] AngularJS to MarkLogic Connectivity Isssue Hi Team, I am trying to save a user entered[page developed in AngularJS] information as a json document in Mark Logic through ML REST API but am facing below issue : browser console: "NetworkError: 401 Unauthorized - http://localhost:8003/v1/documents?uri=/docs/" documen...=/docs/ 2 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8003/v1/documents?uri=/docs/. This can be fixed by moving the resource to the same domain or enabling CORS. In browser NetWork Tab it shows as below : <error-response xmlns="http://marklogic.com/xdmp/error"> <status-code>404</status-code> <status>Not Found</status> <message-code>RESTAPI-NODOCUMENT</message-code> <message>RESTAPI-NODOCUMENT: (err:FOER0000) Resource or document does not exist: category: content message: /docs/userInfo.json </message> </error-response> code tried to connect : $http({ method: 'PUT', url: 'http://localhost:8003/v1/documents?uri=/docs/userInfo.json', data: data1, headers:{ 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With' } }).success(function () {alert('Successfully Added In DB');}); } }); My Angular JS web page is deployed in tomcat on port 7080 and my REST API is located at 8003.Also i have not passed any credentials to connect ML and am not not sure on how to pass authentication . Could you please guide me in getting this resolved. Thanks, Sateesh
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
