github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/http/about.md (about)

     1  ---
     2  title: HTTP
     3  ---
     4  
     5  When Benthos runs it kicks off an HTTP server that provides a few generally useful endpoints and is also where configured components such as the [`http_server` input][inputs.http_server] [and output][outputs.http_server] can register their own endpoints if they don't require their own host/port.
     6  
     7  The configuration for this server lives under the `http` namespace, with the following default values:
     8  
     9  ```yaml
    10  http:
    11    address: 0.0.0.0:4195
    12    enabled: true
    13    root_path: /benthos
    14    debug_endpoints: false
    15    cert_file: ""
    16    key_file: ""
    17    cors:
    18      enabled: false
    19      allowed_origins: []
    20  ```
    21  
    22  The field `enabled` can be set to `false` in order to disable the server.
    23  
    24  The field `root_path` specifies a general prefix for all endpoints, this can help isolate the service endpoints when using a reverse proxy with other shared services. All endpoints will still be registered at the root as well as behind the prefix, e.g. with a `root_path` set to `/foo` the endpoint `/version` will be accessible from both `/version` and `/foo/version`.
    25  
    26  ## Enabling HTTPS
    27  
    28  By default Benthos will serve traffic over HTTP. In order to enforce TLS and serve traffic exclusively over HTTPS you must provide a `cert_file` and `key_file` path in your config, which point to a file containing a certificate and a matching private key for the server respectively.
    29  
    30  If the certificate is signed by a certificate authority, the `cert_file` should be the concatenation of the server's certificate, any intermediates, and the CA's certificate.
    31  
    32  ## Endpoints
    33  
    34  The following endpoints will be generally available when the HTTP server is enabled:
    35  
    36  - `/version` provides version info.
    37  - `/ping` can be used as a liveness probe as it always returns a 200.
    38  - `/ready` can be used as a readiness probe as it serves a 200 only when both the input and output are connected, otherwise a 503 is returned.
    39  - `/metrics`, `/stats` both provide metrics when the metrics type is either [`http_server`][metrics.http_server] or [`prometheus`][metrics.prometheus].
    40  - `/endpoints` provides a JSON object containing a list of available endpoints, including those registered by configured components.
    41  
    42  ## CORS
    43  
    44  In order to serve Cross-Origin Resource Sharing headers, which instruct browsers to allow CORS requests, set the subfield `cors.enabled` to `true`.
    45  
    46  ### allowed_origins
    47  
    48  A list of allowed origins to connect from. The literal value `*` can be specified as a wildcard. Note `cors.enabled` must be set to `true` for this list to take effect.
    49  
    50  ## Debug Endpoints
    51  
    52  The field `debug_endpoints` when set to `true` prompts Benthos to register a few extra endpoints that can be useful for debugging performance or behavioral problems:
    53  
    54  - `/debug/config/json` returns the loaded config as JSON.
    55  - `/debug/config/yaml` returns the loaded config as YAML.
    56  - `/debug/pprof/block` responds with a pprof-formatted block profile.
    57  - `/debug/pprof/heap` responds with a pprof-formatted heap profile.
    58  - `/debug/pprof/mutex` responds with a pprof-formatted mutex profile.
    59  - `/debug/pprof/profile` responds with a pprof-formatted cpu profile.
    60  - `/debug/pprof/symbol` looks up the program counters listed in the request, responding with a table mapping program counters to function names.
    61  - `/debug/pprof/trace` responds with the execution trace in binary form. Tracing lasts for duration specified in seconds GET parameter, or for 1 second if not specified.
    62  - `/debug/stack` returns a snapshot of the current service stack trace.
    63  
    64  [inputs.http_server]: /docs/components/inputs/http_server
    65  [outputs.http_server]: /docs/components/outputs/http_server
    66  [metrics.http_server]: /docs/components/metrics/http_server
    67  [metrics.prometheus]: /docs/components/metrics/prometheus