Gravatar for nbernier@gmail.com

Question by Nicolas Bernier, Oct 30, 2014 3:31 PM

rest api in azure

I have installed coveo front-end on a Azure VM. The site is on port 80 and it is anonymous. I have a endpoint on port 80. The website works well be the jsui is complaning about CORS

XMLHttpRequest cannot load http://nb-coveo.cloudapp.net/Coveo/Rest/?errorsAsSuccess=1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. Search.html:1 ["ERROR", EndpointCaller, "REST request failed", 0, undefined, Object] CoveoJsSearch.js:748

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, Oct 30, 2014 3:44 PM

Origin null means you probably are opening the html file as a static file ? (file:///path/to/your/search/page.html)

This is a security/compatibility concern that most browser enforce when doing CORS requests (cross origin) You'll need to host your html file in IIS or any other web server.

You can read more about CORS here

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Oct 31, 2014 4:43 AM

Also, I strongly suggest you use the standalone REST API instead of the old one bundled with the .NET front-end.

Ask a question