In a Web Request action, I tried to add a header named "referer" with the domain name of the sharepoint tenant as the value (e.g. xxxxx.sharepoint.com; as required by the external application's API) in my web request but I received the following message when I executed the action:
The 'referer' header must be modified using the appropriate property or method.Parameter name: name
I know that in .NET, you have to set the HttpWebRequest.Referer property instead of adding a header. In the Nintex workflow action "Web Request", there is no way to set that property. The external application's API requires that the referer header be exactly the whitelisted domain with no "https://" or trailing slashes, and I'm getting an error response code if I let Nintex Workflow set the referer property.
Is there a workaround here? Or will this require a product change?
Solved! Go to Solution.
I'm not a developer so this reply may be missing the mark but I think you'll want to use the Call HTTP Web Service action instead of the Web Request action. The web service one allows you to supply request headers. Hope that helps otherwise I'll need to hand off to some dev gurus.
The "Call HTTP Web Service" action let me create a 'referer' header with no issues and I was able to process the response content successfully. Thanks for the help! In hindsight, I probably should have thought to try that action, but I just assumed I'd get the same error. It doesn't hurt to try; I need to remember that...
Adding of headers to the request is handled by the workflow engine which is unfortunately not something that we have control over (it's the SharePoint online workflow engine that runs SharePoint Designer & Nintex workflows).
I'll have someone see if we can work out if there is a way to set the named/reserved headers that we can use, if not then I'm not sure it is something that would be possible.
If you need to get this working you may need to look at running the request through a proxy (e.g. an Azure Function) that takes the incoming request, appends the header and forwards. If you do head down this path bear in mind that the timeout of outgoing HTTP requests is 60 seconds from the workflow engine, so your request will need to complete and return back to the workflow in that time.