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.
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>> powershell
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…!!!
Working with Sitecore CMS for more than 10 years now and in total around 14 years of experience working on Microsoft web technologies stack.
Challenges are something which keeps me motivated and moving. I am Sitecore Certified Professional Developer as well as Microsoft Certified Professional Developer. Feel free to hit me up for your Sitecore or web development related queries.