Also, If you have the ability to update to MarkLogic 8, then this is a non-issue with the new Advanced HTTP Server features.
Kind Regards, David Ennis David Ennis *Content Engineer* [image: HintTech] <http://www.hinttech.com/> Mastering the value of content creative | technology | content On 31 March 2015 at 15:41, Varun Shetty <[email protected]> wrote: > You would need a search query transform to apply cross origin headers. > > Headers should be part of your response and not your request. > > These links should help in understanding search query transform > http://docs.marklogic.com/guide/node-dev/extensions#id_78179 > http://docs.marklogic.com/REST/PUT/v1/config/transforms/[name] > > If you are testing locally and want to get rid of the cross domain errors > locally, you can modify the chrome shortcut to add the following arguments. > --args --allow-file-access-from-files --disable-web-security > > > Regards, > Varun Shetty > > > > On Mon, Mar 30, 2015 at 11:23 PM, SateeshKumar Bheemsetty < > [email protected]> wrote: > >> 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] >> http://developer.marklogic.com/mailman/listinfo/general >> >> > > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
