The HTTP Server Input sets up a server to accept HTTP and HTTPS PUT and POST requests. Each request generates an input entry that is passed to the flows. Request messages can be either raw text or JSON-formatted.
{
"inputs": {
"http": {
"type": "httpserver",
"config": {
"url": "http://0.0.0.0:8888",
"format": "json"
}
},
"https": {
"type": "httpserver",
"config": {
"url": "https://0.0.0.0:8889",
"format": "json",
"tls": {
"rejectUnauthorized": false,
"cert": "/path/to/server.crt",
"key": "/path/to/server.key"
}
}
}
}
}- url: The server URL bind pattern. It follows the format
<protocol>://<bind host>:<bind port>. Supported protocols are http and https. - tls: An object passed to the TLS server socket, as described in the Node.js documentation.
- format: The message format. If specified, it must be set to json.
Each HTTP/S request generates an object with the following schema:
{
id: '<input ID>',
type: 'httpserver',
timestamp: Date.now(),
originalMessage: '<http request body>',
server: {
protocol: '<bind protocol>',
port: '<bind port>',
host: '<bind host>'
},
client: {
address: '<client address>',
port: '<client port>'
}
}- The
originalMessagefield contains the body of the HTTP request. - The
serverobject provides details about the server's protocol, port, and host. - The
clientobject includes the client's IP address and port.