Changing the REST Search API Default PortChanging the REST Search API Default Port
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
-
On your server, open a file explorer, and navigate to
\Program Files\Coveo Search API 8
. -
Open
config.yml
in a text editor:-
Add the
http
node before theserver
node. -
Add the
port: [YourDesiredPortNumber]
parameter in thehttp
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¸ [...]
-
In the
applications
node, make sure thatallowImpersonate
istrue
.
-
-
Save the file and close the text editor.
-
If the service was running, restart the Coveo Search API service in the Windows Services snap-in.
Step 2 -Changing the port in Sitecore
-
On your Sitecore server, open a file explorer, and navigate to
<SITECORE_INSTANCE_ROOT>\Website\App_Config\Include\Coveo
. -
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.-
In the
<restEndpointConfiguration>
node, locate the<searchApiUri>
node. -
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).
-
-
Save the file and close the text editor.
Step 3: Verifying Your Setup
-
On your server, open a web browser.
-
In the address bar, type in
localhost:<SEARCH_API_PORT>/rest/search
-
If prompted, authenticate yourself with administrator credentials.
-
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" : [ { [...] }