# Http headers error for multiple msgs

**URL:** <https://discourse.nodered.org/t/http-headers-error-for-multiple-msgs/23270>\
**Category:** General\
**Created:** [18 March 2020 12:36 UTC](https://discourse.nodered.org/t/http-headers-error-for-multiple-msgs/23270 "2020-03-18T12:36:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aitor1skater](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@aitor1skater](https://discourse.nodered.org/u/aitor1skater)\
**Post date:** [18 March 2020 12:36 UTC](https://discourse.nodered.org/t/http-headers-error-for-multiple-msgs/23270/1 "2020-03-18T12:36:33Z")

</div>

Hello everyone,

I am developing a flow that aims to divide a huge message into smaller messages. I have achieved all the logical part for dividing the msg, however, when sending all those small messages to a http response node I get the following error: "Error [ERR\_HTTP\_HEADERS\_SENT]: Cannot set headers after they are sent to the client". Of couse, I specified the headers in the http response node, but without any success so far.

It's important to mention that I get this error after the 1st small message is sent, so yeah, basically the following messages trigger this error.

Any idea how to resolve this error ?

Things that I've tried so far:  
-Specify the headers in the http response.  
-Put a function before the response node and specify the headers of the msg in the function itself.

Thank you !

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [18 March 2020 17:23 UTC](https://discourse.nodered.org/t/http-headers-error-for-multiple-msgs/23270/2 "2020-03-18T17:23:04Z")

</div>

just for confirmation, you're trying to send a streaming response with the http-in/http-response nodes?

If so, the http-in/http-response nodes do not natively support sending a streaming response. Each message passed to the http-response node needs a unique, connected `req`/`resp` objects coming from the http-in node. The connection closes as soon as you send your first message, meaning you can't keep sending more response data to it.

---

<div class="post-metadata">

**Author:** ![aitor1skater](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@aitor1skater](https://discourse.nodered.org/u/aitor1skater)\
**Post date:** [18 March 2020 18:09 UTC](https://discourse.nodered.org/t/http-headers-error-for-multiple-msgs/23270/3 "2020-03-18T18:09:56Z")

</div>

That's exactly what I am trying to make yes. If so, would there be any node that supported a streaming response as you mention ?

So sorry, I am kind of new to these topics.

---

<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:** [17 May 2020 18:10 UTC](https://discourse.nodered.org/t/http-headers-error-for-multiple-msgs/23270/4 "2020-05-17T18:10:02Z")

</div>

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