Access to Webhook request header fields from within a Set node

Hi all,

This is my first post. I hope it does not waste too much of your time.

I am not able to access Webhook HTTP header fields from from within a Set node, but only if the header field name contains a hyphen.

i.e. from within the Set node, {{ $ }} returns a value, but {{ $json.headers.user-agent }} returns null.

What am I doing wrong here? Thanks in advance.

Test data

curl -v -H “User-Agent: test1” “

will return:


Here’s the execution on my hosted server:

Information on my n8n setup

  • n8n version: 0.231.2
  • Database: SQLite
  • Running n8n via Docker
  • Operating system: Ubuntu

Hi @surbitron,

Was your user-agent expression created by n8n UI with drag&drop? Or did you type it manually?

Since there is hyphen (“-”) in object key, you can only get it’s value with {{ $json.headers['user-agent'] }}

I hope it helps.


Thank you @samaritan for the swift reply and for the solution to my problem.

To answer your question, I manually typed the $json.headers.* expressions. I’m still getting used to the UI and I’m struggling to get drag&drop working. The only way I have found of making d&d available when working with Webhooks is to copy the output of the Webhook (Executions tab) into a Code node that returns the JSON immediately. Then I temporarily replace the Webhook with the Code node at the input to the Set node and trigger manually in Edit mode. Is this the standard approach for Webhooks?


Hi @surbitron,

You’re welcome.

You can call test URL of your webhook to help you for developing your workflow. After your first time, you can pin the data for further development. It will help you to save your time.

1 Like

Aha! Works brilliantly! That’s going to save me a lot of time.

Thanks again.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.