The HTTP protocol adapter exposes HTTP based endpoints for Eclipse Hono™’s south bound Telemetry, Event and Command & Control APIs.
The adapter is implemented as a Spring Boot application. It can be run either directly from the command line or by means of starting the corresponding Docker image created from it.
The adapter supports the following standard configuration options:
The following table provides an overview of the configuration variables and corresponding command line options for configuring the HTTP adapter.
| Environment Variable Command Line Option |
Mandatory | Default | Description |
|---|---|---|---|
HONO_APP_MAX_INSTANCES--hono.app.maxInstances |
no | #CPU cores | The number of verticle instances to deploy. If not set, one verticle per processor core is deployed. |
HONO_HTTP_AUTHENTICATION_REQUIRED--hono.http.authenticationRequired |
no | true |
If set to true the protocol adapter requires devices to authenticate when connecting to the adapter. The credentials provided by the device are verified using the configured Credentials Service. Devices that have failed to authenticate are not allowed to publish any data. |
HONO_HTTP_BIND_ADDRESS--hono.http.bindAddress |
no | 127.0.0.1 |
The IP address of the network interface that the secure port should be bound to. See Port Configuration below for details. |
HONO_HTTP_CERT_PATH--hono.http.certPath |
no | - | The absolute path to the PEM file containing the certificate that the protocol adapter should use for authenticating to clients. This option must be used in conjunction with HONO_HTTP_KEY_PATH.Alternatively, the HONO_HTTP_KEY_STORE_PATH option can be used to configure a key store containing both the key as well as the certificate. |
HONO_HTTP_DEFAULTS_ENABLED--hono.http.defaultsEnabled |
no | true |
If set to true the protocol adapter uses default values registered for a device to augment messages published by the device with missing information like a content type. In particular, the protocol adapter adds default values registered for the device as (application) properties with the same name to the AMQP 1.0 messages it sends downstream to the AMQP Messaging Network. |
HONO_HTTP_INSECURE_PORT--hono.http.insecurePort |
no | - | The insecure port the protocol adapter should listen on. See Port Configuration below for details. |
HONO_HTTP_INSECURE_PORT_BIND_ADDRESS--hono.http.insecurePortBindAddress |
no | 127.0.0.1 |
The IP address of the network interface that the insecure port should be bound to. See Port Configuration below for details. |
HONO_HTTP_INSECURE_PORT_ENABLED--hono.http.insecurePortEnabled |
no | false |
If set to true the protocol adapter will open an insecure port (not secured by TLS) using either the port number set via HONO_HTTP_INSECURE_PORT or the default port number (8080) if not set explicitly.See Port Configuration below for details. |
HONO_HTTP_KEY_PATH--hono.http.keyPath |
no | - | The absolute path to the (PKCS8) PEM file containing the private key that the protocol adapter should use for authenticating to clients. This option must be used in conjunction with HONO_HTTP_CERT_PATH. Alternatively, the HONO_HTTP_KEY_STORE_PATH option can be used to configure a key store containing both the key as well as the certificate. |
HONO_HTTP_KEY_STORE_PASSWORD--hono.http.keyStorePassword |
no | - | The password required to read the contents of the key store. |
HONO_HTTP_KEY_STORE_PATH--hono.http.keyStorePath |
no | - | The absolute path to the Java key store containing the private key and certificate that the protocol adapter should use for authenticating to clients. Either this option or the HONO_HTTP_KEY_PATH and HONO_HTTP_CERT_PATH options need to be set in order to enable TLS secured connections with clients. The key store format can be either JKS or PKCS12 indicated by a .jks or .p12 file suffix respectively. |
HONO_HTTP_SNI--hono.http.sni |
no | false |
Set whether the server supports Server Name Indication. By default, the server will not support SNI and the option is false. However, if set to true then the key store format , HONO_HTTP_KEY_STORE_PATH, should be either JKS or PKCS12 indicated by a .jks or .p12 file suffix respectively. |
HONO_HTTP_NATIVE_TLS_REQUIRED--hono.http.nativeTlsRequired |
no | false |
The server will probe for OpenSLL on startup if a secure port is configured. By default, the server will fall back to the JVM’s default SSL engine if not available. However, if set to true, the server will fail to start at all in this case. |
HONO_HTTP_MAX_PAYLOAD_SIZE--hono.http.maxPayloadSize |
no | 2048 |
The maximum allowed size of an incoming HTTP request’s body in bytes. Requests with a larger body size are rejected with a 413 Request entity too large response. |
HONO_HTTP_PORT--hono.http.port |
no | 8443 |
The secure port that the protocol adapter should listen on. See Port Configuration below for details. |
HONO_HTTP_REALM--hono.http.realm |
no | Hono |
The name of the realm that unauthenticated devices are prompted to provide credentials for. The realm is used in the WWW-Authenticate header returned to devices in response to unauthenticated requests. |
HONO_HTTP_SECUREPROTOCOLS--hono.http.secureProtocols |
no | TLSv1.3,TLSv1.2 |
A (comma separated) list of secure protocols (in order of preference) that are supported when negotiating TLS sessions. Please refer to the vert.x documentation for a list of supported protocol names. |
HONO_AMQP_SUPPORTEDCIPHERSUITES--hono.amqp.supportedCipherSuites |
no | - | A (comma separated) list of names of cipher suites (in order of preference) that the adapter may use in TLS sessions with devices. Please refer to JSSE Cipher Suite Names for a list of supported names. |
HONO_HTTP_TENANT_IDLE_TIMEOUT--hono.http.tenantIdleTimeout |
no | 0ms |
The duration after which the protocol adapter removes local state of the tenant (e.g. open AMQP links) with an amount and a unit, e.g. 2h for 2 hours. See the Spring Boot documentation for an explanation of the format. The value 0ms disables the timeout. |
The variables only need to be set if the default value does not match your environment.
The HTTP protocol adapter can be configured to listen for connections on
The HTTP protocol adapter will fail to start if none of the ports is configured properly.
The protocol adapter needs to be configured with a private key and certificate in order to open a TLS secured port.
There are two alternative ways for doing so:
HONO_HTTP_KEY_STORE_PATH and the HONO_HTTP_KEY_STORE_PASSWORD variables in order to load the key & certificate from a password protected key store, orHONO_HTTP_KEY_PATH and HONO_HTTP_CERT_PATH variables in order to load the key and certificate from two separate PEM files in PKCS8 format.When starting up, the protocol adapter will bind a TLS secured socket to the default secure port 8443. The port number can also be set explicitly using the HONO_HTTP_PORT variable.
The HONO_HTTP_BIND_ADDRESS variable can be used to specify the network interface that the port should be exposed on. By default the port is bound to the loopback device only, i.e. the port will only be accessible from the local host. Setting this variable to 0.0.0.0 will let the port being bound to all network interfaces (be careful not to expose the port unintentionally to the outside world).
The secure port will mostly be required for production scenarios. However, it might be desirable to expose a non-TLS secured port instead, e.g. for testing purposes. In any case, the non-secure port needs to be explicitly enabled either by
HONO_HTTP_INSECURE_PORT to a valid port number, or byHONO_HTTP_INSECURE_PORT_ENABLED to true.The protocol adapter issues a warning on the console if HONO_HTTP_INSECURE_PORT is set to the default secure HTTP port (8443).
The HONO_HTTP_INSECURE_PORT_BIND_ADDRESS variable can be used to specify the network interface that the port should be exposed on. By default the port is bound to the loopback device only, i.e. the port will only be accessible from the local host. This variable might be used to e.g. expose the non-TLS secured port on a local interface only, thus providing easy access from within the local network, while still requiring encrypted communication when accessed from the outside over public network infrastructure.
Setting this variable to 0.0.0.0 will let the port being bound to all network interfaces (be careful not to expose the port unintentionally to the outside world).
The protocol adapter may be configured to open both a secure and a non-secure port at the same time simply by configuring both ports as described above. For this to work, both ports must be configured to use different port numbers, otherwise startup will fail.
Both the secure as well as the insecure port numbers may be explicitly set to 0. The protocol adapter will then use arbitrary (unused) port numbers determined by the operating system during startup.