diff --git a/x-pack/filebeat/docs/inputs/input-http-endpoint.asciidoc b/x-pack/filebeat/docs/inputs/input-http-endpoint.asciidoc index 2a949b01d26..18d60e9e145 100644 --- a/x-pack/filebeat/docs/inputs/input-http-endpoint.asciidoc +++ b/x-pack/filebeat/docs/inputs/input-http-endpoint.asciidoc @@ -41,6 +41,17 @@ Custom response example: prefix: "json" ---- +Disable Content-Type checks +["source","yaml",subs="attributes"] +---- +{beatname_lc}.inputs: +- type: http_endpoint + enabled: true + listen_address: 192.168.1.1 + content_type: "" + prefix: "json" +---- + Basic auth and SSL example: ["source","yaml",subs="attributes"] ---- @@ -80,6 +91,12 @@ If `basic_auth` is enabled, this is the username used for authentication against If `basic_auth` is eanbled, this is the password used for authentication against the HTTP listener. Requires `username` to also be set. +[float] +==== `content_type` + +By default the input expects the incoming POST to include a Content-Type of `application/json` to try to enforce the incoming data to be valid JSON. +In certain scenarios when the source of the request is not able to do that, it can be overwritten with another value or set to null + [float] ==== `response_code` diff --git a/x-pack/filebeat/input/http_endpoint/config.go b/x-pack/filebeat/input/http_endpoint/config.go index 41e97489cec..acd549e77ee 100644 --- a/x-pack/filebeat/input/http_endpoint/config.go +++ b/x-pack/filebeat/input/http_endpoint/config.go @@ -23,6 +23,7 @@ type config struct { ListenPort string `config:"listen_port"` URL string `config:"url"` Prefix string `config:"prefix"` + ContentType string `config:"content_type"` } func defaultConfig() config { @@ -36,6 +37,7 @@ func defaultConfig() config { ListenPort: "8000", URL: "/", Prefix: "json", + ContentType: "application/json", } } diff --git a/x-pack/filebeat/input/http_endpoint/input.go b/x-pack/filebeat/input/http_endpoint/input.go index c79fd2cba22..e21fb4325b2 100644 --- a/x-pack/filebeat/input/http_endpoint/input.go +++ b/x-pack/filebeat/input/http_endpoint/input.go @@ -87,7 +87,7 @@ func (e *httpEndpoint) Run(ctx v2.Context, publisher stateless.Publisher) error username: e.config.Username, password: e.config.Password, method: http.MethodPost, - contentType: "application/json", + contentType: e.config.ContentType, } handler := &httpHandler{