Proper response for notehub route event

Hi there,

I’ve setup a http server as an end point to a route using this tutorial:

I receive the data sent from notehub to my server successfully.

After my server receives the data it needs to send a response to notehub that indicates “success”. The problem that my CGI script (written in bash) is not sending the correct response so, as far as notehub knows, each routing event fails.

My current output is:
printf ‘%b’ ‘HTTP/1.1 200 OK\r\n’

My question:
what should I send (as a response) back to notehub?

Hey @tomnorm,

And welcome to the Blues community!

I’m not an expert in CGI scripts or bash, but I would’ve expected your simple script to work ok. As an idea maybe you could include a body in your response and a Content-Type header?

The response body can be nice for debugging anyways as it shows up in the Route Log for each individual event.

TJ

HTTP/1.1 needs

HTTP/1.1 200 OK
Content-Length: 0

and HTTP/1.0 just needs

HTTP/1.0 200 OK

Thank you both.

@tjvantoll very helpful. The error was:

error performing request: error on HTTP request to ROUTE: Post “ROUTE”: EOF

@datalogger Thanks!

Solution (the last \r\n is important):
printf '%b' 'HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n'