Skip to main content

http_server

Sets up an HTTP server that will send messages over HTTP(S) GET requests. HTTP 2.0 is supported when using TLS, which is enabled when key and cert files are specified.

# Common config fields, showing default values
output:
label: ""
http_server:
address: ""
path: /get
stream_path: /get/stream
ws_path: /get/ws
allowed_verbs:
- GET

Sets up an HTTP server that will send messages over HTTP(S) GET requests. If the address config field is left blank the service-wide HTTP server will be used.

Three endpoints will be registered at the paths specified by the fields path, stream_path and ws_path. Which allow you to consume a single message batch, a continuous stream of line delimited messages, or a websocket of messages for each request respectively.

When messages are batched the path endpoint encodes the batch according to RFC1341. This behaviour can be overridden by archiving your batches.

Fields

address

An optional address to listen from. If left empty the service wide HTTP server is used.

Type: string
Default: ""

path

The path from which discrete messages can be consumed.

Type: string
Default: "/get"

stream_path

The path from which a continuous stream of messages can be consumed.

Type: string
Default: "/get/stream"

ws_path

The path from which websocket connections can be established.

Type: string
Default: "/get/ws"

allowed_verbs

An array of verbs that are allowed for the path and stream_path HTTP endpoint.

Type: array
Default: ["GET"]

timeout

The maximum time to wait before a blocking, inactive connection is dropped (only applies to the path endpoint).

Type: string
Default: "5s"

cert_file

An optional certificate file to use for TLS connections. Only applicable when an address is specified.

Type: string
Default: ""

key_file

An optional certificate key file to use for TLS connections. Only applicable when an address is specified.

Type: string
Default: ""

cors

Adds Cross-Origin Resource Sharing headers. Only valid with a custom address.

Type: object
Requires version 3.63.0 or newer

cors.enabled

Whether to allow CORS requests.

Type: bool
Default: false

cors.allowed_origins

An explicit list of origins that are allowed for CORS requests.

Type: array
Default: []