While configuring Coveo search on my local development environment using Docker, something got my attention on Coveo’s diagnosis page(<<Sitecore CM Host>>/sitecore modules/Web/Coveo/Admin/CoveoDiagnosticPage.aspx).
This page has all the green ticks except for the one. This is Coveo Search REST Endpoint. See image below for more details.
As usually, I copied the API end point URL and hit in the Browser and it serve the request with no error. It is HTTP-200 response with valid JSON result.
The error in the log file also not giving any lead either.
Coveo.SearchProvider.Applications.BaseVerifier.VerifyComponent(:0) ERROR StateVerifier has encountered an error while verifying the component "Coveo Search REST Endpoint".<br>Exception: Coveo.SearchProvider.Applications.StateVerifierException<br>Message: Failed to obtain resource located at 'http://sicore930.dev.local/coveo/rest/'. See inner exception for details.<br>Source: Coveo.SearchProvider.Applications<br>at Coveo.SearchProvider.Applications.CommonStateVerifier.TryPingRestEndpoint(String p_Endpoint)<br>at Coveo.SearchProvider.Applications.CommonStateVerifier.<>c__DisplayClass11_0.b__0()<br>at Coveo.SearchProvider.Applications.BaseVerifier.VerifyComponent(Func`1 p_VerifyMethod, String p_ComponentName)
I opened docker powershell command for the cm container and tried to request the host from within container.
PS> Docker container ls
Grab the name or container id
PS> Docker exec -it <<container name/id>> cmd
This will open a powershell window connected to the container specified.
PS> Invoke-RestMethod -Uri "http://sitecore930.dev.local/coveo/rest" | ConvertTo-Json
It has given me following error
Now things are little clear to me. The Coveo diagnosis page is using current host to make REST API request from IIS server running on the container. The container does not have host file entry to reseolve the host url.
So now, I started searching how to make entry in container’s host file??? I was sure, I am not the first person who wanted this kind of stuff.
Following PoweShell command has does the trick.
PS> echo 127.0.0.1 sitecore930.dev.local >> "C:\Windows\System32\drivers\etc\hosts"
After executing above command on Container’s powershell, now my Coveo Diagnosis page is Happy…!!!
Please do let me know, is there any better solution you guys have in place for this issue.
Till that time happy Coveo searching…!!!