Skip to main content

HTTP

Type: bindings.http

Status: stable

Reference: https://docs.dapr.io/reference/components-reference/supported-bindings/http/

Example

apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
name: <name>
spec:
type: bindings.http
version: v1
metadata:
# The base URL of the HTTP endpoint to invoke
- name: url
value: "http://host:port/path, http://myservice:8000/customer"
# Client certificate for mTLS: either a PEM-encoded string, or a path to a certificate on disk (Optional)
#- name: MTLSClientCert
# value: |
# /path/to/client.pem
# Client key for mTLS: either a PEM-encoded string, or a path to a certificate on disk (Optional)
#- name: MTLSClientKey
# value: |
# /path/to/client.key
# Set TLS renegotiation setting (Optional)
#- name: MTLSRenegotiation
# value: "RenegotiateOnceAsClient"
# CA certificate: either a PEM-encoded string, or a path to a certificate on disk (Optional)
#- name: MTLSRootCA
# value: |
# /path/to/ca.pem
# Max amount of data to read from the response body, as a resource quantity. A value `<= 0` means no limit. (Optional)
#- name: maxResponseBodySize
# value: "100Mi"
# The duration after which HTTP requests should be canceled. (Optional)
#- name: responseTimeout
# value: "10s, 5m"
# The security token to include on an outgoing HTTP request as a header (Optional)
#- name: securityToken
# value: "this-value-is-preferably-injected-from-a-secret-store"
# The header name on an outgoing HTTP request for a security token (Optional)
#- name: securityTokenHeader
# value: "X-Security-Token"

Binding information

Input Binding: no

Output Binding: yes

Output Binding operations:

  • create: Alias for "post", for backwards-compatibility

  • get: Read data/records

  • head: Identical to get except that the server does not return a response body

  • post: Typically used to create records or send commands

  • put: Update data/records

  • patch: Sometimes used to update a subset of fields of a record

  • delete: Delete data/record

  • options: Requests for information about the communication options available (not commonly used)

  • trace: Used to invoke a remote, application-layer loop-back of the request message (not commonly used)

Metadata

url

Required - The base URL of the HTTP endpoint to invoke

Example value: http://host:port/path, http://myservice:8000/customer

MTLSClientCert

Client certificate for mTLS: either a PEM-encoded string, or a path to a certificate on disk

Example value:

/path/to/client.pem

MTLSClientKey

Client key for mTLS: either a PEM-encoded string, or a path to a certificate on disk

Example value:

/path/to/client.key

MTLSRenegotiation

Set TLS renegotiation setting

Example value: RenegotiateOnceAsClient

Allowed values:

  • RenegotiateNever

  • RenegotiateOnceAsClient

  • RenegotiateFreelyAsClient

MTLSRootCA

CA certificate: either a PEM-encoded string, or a path to a certificate on disk

Example value:

/path/to/ca.pem

maxResponseBodySize (bytesize)

Max amount of data to read from the response body, as a resource quantity. A value <= 0 means no limit.

Default value: 100Mi

Example value: 100 (as bytes), 1k, 10Ki, 1M, 1G

responseTimeout

The duration after which HTTP requests should be canceled.

Example value: 10s, 5m

securityToken

The security token to include on an outgoing HTTP request as a header

Example value: this-value-is-preferably-injected-from-a-secret-store

securityTokenHeader

The header name on an outgoing HTTP request for a security token

Example value: X-Security-Token