Forum Discussion

wmorrr's avatar
wmorrr
Copper Contributor
Aug 08, 2022
Solved

SharePoint 2019 Home Page - Search Query Returns 401 Unauthorized

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-2019-farms 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").

 

 

https://home.domain.com/sites/search/_api/search/suggest?querytext='test'&inumberofquerysuggestions=3&culture=1033&inumberofresultsuggestions=0&fprequerysuggestions=true&fhithighlighting=true&fcapitalizefirstletters=false&fprefixmatchallterms=false&showpeoplenamesuggestions=false

 

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!

  • 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 Reply

  • wmorrr's avatar
    wmorrr
    Copper Contributor
    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.

Resources