Issue

Recently you have reconfigured your environment to move from HTTP over to HTTPS. During this process you have gone through the necessary configuration steps and see that both K2 and SharePoint are functioning. However, on some of your sites you will get the following error when hitting the K2 App from a list/library, or attempting to activate the site:

"Thread 1: The remote server returned an error: (401) Unauthorized."

Image

Symptoms

- You currently use a URL Rewrite on the SharePoint Web Application tied to the sites that see this issue. This is configured within IIS Manager. When disabling this URL rewrite the error disappears.

https://blogs.technet.microsoft.com/dawiese/2016/06/07/redirect-from-http-to-https-using-the-iis-url-rewrite-module/

- Using a fiddler trace with the URL rewrite disabled, there are a lot of calls to your SharePoint site that are still hitting the HTTP URL:

"http://portal.denallix.com/sites/sitename/_vti_bin/client.svc/ProcessQuery"

- You may also see these hits to the HTTP URL within the Verbose SharePoint ULS logs.

- You'll notice  on the hidden K2 settings list for a working and non-working site that the proper URLs are supplied. Modify the below URL to your SharePoint site to get to the hidden SharePoint list that K2 creates on each site where the app is activated:

"https://portal.denallix.com/sites/sitename/lists/K2 Settings"

- Attempting to run any of the SmartObjects in the SharePoint 2013 > [Site Category] > Management will give the same behavior and error.

Resolution

This is caused by the SharePoint 2013 service instance still having the HTTP URL as a value for the Site URL Service Key

Image

Updating the service key via K2 Management or the SmartObject service tester tool is not supported. The overall refresh of a SharePoint service instance should be done via the Activation/Registration wizard on the K2 App within SharePoint. 

Please reach out to K2 Support in order to update the Service Instance XML in the K2 Database. To speed up the process it is recommended that you create a full backup of the K2 Database in case any unforeseen issues appear while updating this data in the K2 DB.

Please note that any modifications of the K2 Database without instruction and guidance from K2 is unsupported and could result in system instability or failure: http://help.k2.com/onlinehelp/k2blackpearl/devref/current/default.htm#Database_Reference.html