HTTP Post reply 400

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:

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

return msg;

Then a http post request


The reply is:

<!DOCTYPE html>
<html xmlns=""xml:lang="en" lang="en">
<b>400 Bad Request: No Host Header</b>

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

Any idea?

Hi all,
I go a reply on github.

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

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

Issue closed!

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.

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