Solved

Web request - "referer" header/property

  • 29 January 2018
  • 5 replies
  • 48 views

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?

 

Thanks

icon

Best answer by Chris_Ben 30 January 2018, 06:06

View original

5 replies

Userlevel 6
Badge +12

Hi Robert,

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. 

Cheers,

Chris

Badge +9

Hi Robert,

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.

Thanks,


Callum

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...

Userlevel 6
Badge +12

Good stuff!

I had considered using Azure as a last resort, but we want to keep the process strictly within Nintex.  Chris Ben's suggestion to try the "Call HTTP Web Service" action worked for me, so as far as I'm concerned, this issue is resolved.  It's possible someone later on might need to specifically use the "Web Request" action and also need to use a reserved header name, so it might be worth investigating the possibility of a fix. Thanks for the response!

Reply