# HTTP Post reply 400

**URL:** <https://discourse.nodered.org/t/http-post-reply-400/21101>\
**Category:** General\
**Created:** [31 January 2020 15:00 UTC](https://discourse.nodered.org/t/http-post-reply-400/21101 "2020-01-31T15:00:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![khfischbach](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/khfischbach/32/16627_2.png) [@khfischbach](https://discourse.nodered.org/u/khfischbach)\
**Post date:** [31 January 2020 15:00 UTC](https://discourse.nodered.org/t/http-post-reply-400/21101/1 "2020-01-31T15:00:42Z")

</div>

Hi,  
I am trying to create a HTTP Post but I always get a reply "400 Bad Request: No Host Header".  
I guess I know what it means, but I don't know how to overcome.

I have a inject and a function:

```auto
msg.payload = 'id=625&show=D_C_1_1~';
msg.headers = {};
msg.headers={
    'Content-Type': 'application/x-www-form-urlencoded'
};

return msg;

```

Then a http post request

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/3/33a8cb3ed1ff8e082baa86b82d0cb0613538b832.png)

The reply is:

```auto
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"xml:lang="en" lang="en">
<head>
<title>Error</title>
</head>
<body>
<b>400 Bad Request: No Host Header</b>
<br/>
/mux_http
<br/>
</body>
</html>

```

That looks to me as if parts of the url are not submitted.

Any idea?  
Regards  
Kallewirsch

---

<div class="post-metadata">

**Author:** ![khfischbach](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/khfischbach/32/16627_2.png) [@khfischbach](https://discourse.nodered.org/u/khfischbach)\
**Post date:** [1 February 2020 17:00 UTC](https://discourse.nodered.org/t/http-post-reply-400/21101/2 "2020-02-01T17:00:24Z")

</div>

Hi all,  
I go a reply on github.  
Result:

```auto
msg.topic = 'Gruenbeck post';
msg.method = 'POST';
msg.url = 'http://f42240gb.example.com/mux_http';
msg.payload = 'id=625&show=D_A_1_2~';
msg.headers = {};
msg.headers={
    'Content-Length': '22',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Host': 'f42240gb.example.com'
};

return msg;

```

This now works!

I have searched the web very intensively the last days but did not find a hint in that direction.  
I know, there are probably 100 parameters you can add to the HTTP-request an only an expert can find out where to put what - bu I am no expert in HTTP - realy not.

So this might help some other people with this as an expample for the HTTP-Request with "POST".

Thanks  
Kallewirsch  
Issue closed!

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 February 2020 17:29 UTC](https://discourse.nodered.org/t/http-post-reply-400/21101/3 "2020-02-01T17:29:08Z")

</div>

To repeat what I said in GitHub (aside from, please don't cross post questions in both places), the Host header is a fundamental part of an http request. You should not have to set it.

So we'll keep the issue open on GitHub so we can investigate why the header is missing for you.

---

<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:** [1 April 2020 17:29 UTC](https://discourse.nodered.org/t/http-post-reply-400/21101/4 "2020-04-01T17:29:10Z")

</div>

Closed on 1 April 2020 17:29 UTC

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