SOLVED

SharePoint 2019 Home Page - Search Query Returns 401 Unauthorized

Copper Contributor

Hello,

 

When working with SharePoint 2019, executing a Search query  from the SharePoint Home/Start Page (i.e., sharepoint.aspx) results in 401 unauthorized. This only occurs when setting a Global Search Center URL (which is part of the requirements).

 

See https://docs.microsoft.com/en-us/sharepoint/sites/enable-sharepoint-home-page-in-sharepoint-server-2... for background.

 

We have two hosts:

https://home.domain.com

https://my.domain.com

 

The former hosts the Global Search Center and the latter hosts the SharePoint Home Page (sharepoint.aspx). If you run a search query, the following request is sent (supposing I search for the value "test").

wmorrr_0-1659995518601.png

 

 

https://home.domain.com/sites/search/_api/search/suggest?querytext='test'&inumberofquerysuggestions=...

 

If I don't have a Global Search Center URL specified, then the search api query shown above will be sent to the MySites host and all is well. However, in this cross-domain scenario, where my.domain.com invokes the search api call on home.domain.com, it results in a 401 unauthorized response. My OPTIONS request (prior to the GET call) does pass with a 200 OK, so this doesn't appear to be CORS related on the surface; not dismissing any explanations though :)

 

Any advice on this? Have you successfully set this up and seen it work - mysites host calling the search api on a different host (due to having Global Search Center configured) through the SharePoint Home Page (sharepoint.aspx)?

 

Thanks!

1 Reply
best response confirmed by wmorrr (Copper Contributor)
Solution
I implemented a work-around. I created a new Enterprise Search Center site collection on the MySites host. Then, I set that URL in the site collection Search settings for said web application. Now, MySites no longer goes cross domain but still has the full power of Enterprise Search.
1 best response

Accepted Solutions
best response confirmed by wmorrr (Copper Contributor)
Solution
I implemented a work-around. I created a new Enterprise Search Center site collection on the MySites host. Then, I set that URL in the site collection Search settings for said web application. Now, MySites no longer goes cross domain but still has the full power of Enterprise Search.

View solution in original post