THIS IS ARCHIVED DOCUMENTATION

Changing the REST Search API Default PortChanging the REST Search API Default Port

On-Premises only

In your on-premises installation, you may have several applications running, each using ports of their own to communicate with other resources. If there’s a conflict with the default port or if the port is too busy, you may want to redirect the traffic of the Search API to an unused one. To do so, you need to modify a few lines in the Coveo for Sitecore and CES configuration files. You should also make sure that the port is open on your server.

Step 1: Changing the Port in the config.yml

  1. On your server, open a file explorer, and navigate to \Program Files\Coveo Search API 8.

  2. Open config.yml in a text editor:

    1. Add the http node before the server node.

    2. Add the port: [YourDesiredPortNumber] parameter in the http node.

       http:
         port: [PortNumber]
       server:
         uri: https://localhost:[CESPort, default is 8080]
         serverCertificatePath: C:\CES7\Config\Certificates\cert-ca.pem
         clientCertificatePath: C:\CES7\Config\Certificates\cert-iis.p12¸
       [...]
      
    3. In the applications node, make sure that allowImpersonate is true.

  3. Save the file and close the text editor.

  4. If the service was running, restart the Coveo Search API service in the Windows Services snap-in.

Step 2 -Changing the port in Sitecore

  1. On your Sitecore server, open a file explorer, and navigate to <SITECORE_INSTANCE_ROOT>\Website\App_Config\Include\Coveo.

  2. Open Coveo.SearchProvider.Rest.Custom.config in a text editor:

    You should always avoid modifying the Coveo.SearchProvider.Rest.config since the update process overwrites this file.

    Customize the *.custom.config so it retains your modifications.

    1. In the <restEndpointConfiguration> node, locate the <searchApiUri> node.

    2. Change the path in the <searchApiUri> node to the one in the config.yml file that you set above in the procedure of Step 1: Changing the port in the config.yml (step 2.b).

  3. Save the file and close the text editor.

Step 3: Verifying Your Setup

  1. On your server, open a web browser.

  2. In the address bar, type in localhost:<SEARCH_API_PORT>/rest/search

  3. If prompted, authenticate yourself with administrator credentials.

  4. Your web browser should now return a JSON file looking like this:

     {
       "totalCount" : 122,
       "totalCountFiltered" : 122,
       "duration" : 2552,
       "indexDuration" : 215,
       "requestDuration" : 2063,
       "searchUid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
       "pipeline" : "wxyz",
       "apiVersion" : 2,
       "triggers" : [ ],
       "termsToHighlight" : { },
       "phrasesToHighlight" : { },
       "queryCorrections" : [ ],
       "groupByResults" : [ ],
       "results" : [ {
     [...]
    
     }