# Http-request headers

**URL:** https://discourse.nodered.org/t/http-request-headers/96310
**Category:** General
**Created:** [28 March 2025 11:30 UTC](https://discourse.nodered.org/t/http-request-headers/96310 "2025-03-28T11:30:24Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [28 March 2025 11:30 UTC](https://discourse.nodered.org/t/http-request-headers/96310/1 "2025-03-28T11:30:24Z")

</div>

The terms of service for the API I'm accessing, [yr.no](https://developer.yr.no/doc/TermsOfService/) say, amongst other requirements:

```auto
All requests must (if possible) include an identifying User Agent-string (UA) in the request with the application/domain name, optionally version number. You should also include a company email address or a link to the company website where we can find contact information. If we cannot contact you in case of problems, you risk being blocked without warning.
Examples of valid User-Agents:
"acmeweathersite.com support@acmeweathersite.com"
"AcmeWeatherApp/0.9 github.com/acmeweatherapp"

```

I think I can comply with this by setting msg.headers to

```auto
{
   "User-Agent":"Node-RED test / me@mymail.com",
   "If-Modified-Since":"foobar"
}

```

1. Is this the right syntax to set the headers?
2. Is there any way to see the outgoing request with all of it's headers?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [28 March 2025 11:40 UTC](https://discourse.nodered.org/t/http-request-headers/96310/2 "2025-03-28T11:40:30Z")

</div>

Should be enough to do this in the UI

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/5/a521a7c493bf60b66e20da962174aedac524169a.png)

To check the headers - you can send the request to your own endpoint URL and use a debug set to show full message.

#### endpoint

```log
http-in URL=/dummy -------> http-response
                   |-------> debug

```

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [28 March 2025 12:02 UTC](https://discourse.nodered.org/t/http-request-headers/96310/3 "2025-03-28T12:02:40Z")

</div>

Thanks Steve.

Clarifying for my future reference:

Creating an endpoint: that's just an http-in node with URL `/dummy`  
And the http-request to call it has URL `http://localhost:1880/dummy`

The request times out because I have not coded an html response & matching http-out node, but the debug shows

```auto
{
    "user-agent":"\"Node-RED me@here.com\"",
    "if-modified-since":"foobar",
    "host":"localhost:1880",
    "connection":"keep-alive"
}

```

I assume that the lower case header property names will not be an issue.

👍

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [11 April 2025 12:03 UTC](https://discourse.nodered.org/t/http-request-headers/96310/4 "2025-04-11T12:03:03Z")

</div>

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