HTTP Server

http.server.api_enabled

Abbreviation ht s a
Accessget/set

Description

Enable the HTTP Server RESTful API. See Networking and Security, HTTP Server RESTful API.

The API is enabled by default, so enabling the HTTP server with http.server.enabled also allows access to the API. To disable HTTP RESTful API calls when the HTTP server is running, set http.server.api_enabled to 0.

Arguments

<0/1>

Default

1

Properties

Supported Platforms

Get example

> get http.server.api_enabled
1

Set example

> set ht s a 0
Set OK

http.server.auth_title

Abbreviation ht s h
Accessget/set

Description

Configure the authentication header displayed when a user fails to enter a valid username or password. This sets the title of a web browser's authentication dialog.

ZentriOS sets the variable value in the WWW-Authenticate HTTP header:

WWW-Authenticate: Basic realm=<http.server.auth_title>

This variable should be used with http.server.username and http.server.password.

Arguments

title

Default

"" (empty)

Supported Platforms

Set example

> set http.server.auth_title MyServer
Set OK

Get example

> get http.server.auth_title
MyServer

http.server.cors_origin

Abbreviation ht s c
Accessget/set

Description

Specifies origins for which the web browser same-origin policy is relaxed.

If <origin> is set to an empty string, then CORS is completely disabled.

For requests without credentials, a value of * acts as a wildcard, allowing any origin to access the resource.

See HTTP Server RESTful API, CORS.

Arguments

<origin>

Default

"" (empty string). To set the http.server.cors_origin variable to the empty string, supply an argument with two double quotes: ""

Properties

Supported Platforms

Get example

> get http.server.cors_origin

Set example

> set ht s c *
Set OK

http.server.denied_filename

Abbreviation ht s d
Accessget/set

Description

Specify the file name of the page to be displayed in the event that the HTTP server denies authentication.

Arguments

<filename>

Default

''

Properties

Supported Platforms

Get example

> get http.server.denied_filename

Set example

> set ht s d access_denied.html
Set OK

http.server.enabled

Abbreviation ht s e
Accessget/set

Description

Enable the HTTP server. See Networking and Security, HTTP Server RESTful API.

Arguments

<1/0>

Default

0

Properties

Supported Platforms

Get example

> get ht s e
0

Set example

> set ht s e 1
Set OK

http.server.interface

Abbreviation ht s i
Accessget/set

Description

Specifies the network interface used by the HTTP server. See Networking and Security, HTTP Server RESTful API.

Arguments

<default/softap/wlan>

Default

default

Properties

Supported Platforms

Get example

> get http.server.interface
default

Set example

> set ht s i wlan
Set OK

http.server.max_clients

Abbreviation ht s m
Accessget/set

Description

Specifies the maximum number of clients the HTTP server allows to connect.

Restricting connected clients may be necessary to limit memory usage. See Memory.

Arguments

<clients>

Default

3 Range: 1 - 8

Properties

Supported Platforms

Get example

> get http.server.max_clients
3

Set example

> set ht s m 1
Set OK

http.server.notfound_filename

Abbreviation ht s n
Accessget/set

Description

Specifies the filename of the web page to be displayed in the event that the HTTP server reports a 404 - not found error. <filename>

Default

''

Properties

Supported Platforms

Get example

> get http.server.notfound_filename

Set example

> set ht s n notfound.html
Set OK

http.server.password

Abbreviation ht s w
Accessget/set

Description

Set the password of the http server. The username MUST be set as well for the http server to start.

See HTTP Server Security and Authorization.

Arguments

<password>

Default

null

Properties

Supported Platforms

Get example

> get ht s w
secretpassword

Set example

> set ht s w secretpassword
Set OK

http.server.port

Abbreviation ht s p
Accessget/set

Description

Set the port on which the HTTP server listens. See Networking and Security, HTTP Server RESTful API.

Arguments

<listening port>

Default

80

Properties

Supported Platforms

Get example

> get ht s p
80

Set example

> set http.server.port 8080
Set OK

http.server.root_filename

Abbreviation ht s r
Accessget/set

Description

This sets or gets the root file of the HTTP server. If a plain request to http:// is issued, with no url specified, this file is returned.

See Networking and Security, HTTP Server RESTful API.

Arguments

<filename>

Default

/setup/index.html

Properties

Supported Platforms

Get example

> get ht s r
/setup/index.html

Set example

> set http.server.root_filename /setup/home.html
Set OK

http.server.tls_cert

Abbreviation ht s l
Accessget/set

Description

The server TLS CA certificate filename.

Arguments

<filename>

Default

null

Properties

Supported Platforms

Get example

> get ht s c
mycert.pem

Set example

> set ht s c mycert.pem
Set OK

http.server.tls_client_log

Abbreviationht s g
Accessget

Description

Return list of recently connected clients. Up to 8 clients are logged. When the log contains 8 clients and a new client is added, the oldest client is removed. Requires http.server.tls_log_clients to be enabled.

Arguments

-

Default

null

Supported Platforms

Get example

> get http.server.tls_client_log
! # Timestamp     Common Name
# 0 1422233232123 name@email.com
# 1 1422233232123 name2@email.com

Note: The timestamp shows the last time the client issued an HTTP request to the server, as system UTC time in milliseconds.

http.server.tls_enabled

Abbreviation ht s t
Accessget/set

Description

Enable server Transport Level Security (TLS).

Arguments

<1/0>

Default

0

Properties

Supported Platforms

Get example

> get ht s t
0

Set example

> set ht s t 1
Set OK

http.server.tls_key

Abbreviation ht s k
Accessget/set

The server TLS certificate key filename.

Arguments

<filename>

Default

null

Get example

> get ht s k
mycert.key

Set example

> set ht s k mycert.key
Set OK

http.server.tls_log_clients

Abbreviationht s o
Accessget/set

Properties

Supported Platforms

Description

Enable/disable TLS client logging. http.server.tls_verify_peer must be enabled for this feature.

See http.server.tls_client_log

Arguments

<0|false/1|true>

Default

false

Properties

Supported Platforms

Get example

> get http.server.tls_log_clients
0

Get example

> set http.server.tls_log_clients 1
Set OK

http.server.tls_verify_peer

Abbreviation ht s v
Accessget/set

Description

When this variable is set, a connecting client must provide a valid TLS certificate that the server validates. The client is disconnected if the provided certifcate is invalid. Note: The http.server.tls_cert variable must be set if using this feature.

Arguments

<0/1>

Default

0

Properties

Supported Platforms

Get example

> get ht s v
0

Set example

> set ht s v 1
Set OK

http.server.username

Abbreviation ht s u
Accessget/set

Description

Set the username of the http server. The password MUST be set as well for the http server to start.

See HTTP Server Security and Authorization.

Arguments

<username>

Default

null

Properties

Supported Platforms

Get example

> get http.server.username
cyrano

Set example

> set ht s u cyrano
Set OK

http.server.ws_connected_gpio

Abbreviation ht s x
Accessget/set

Description

The GPIO used to indicate whether a websocket stream is connected. It is asserted when one or more websocket streams are open.

Note: Set to -1 to disable feature and free assigned GPIO.

See also system.oob.gpio.

Arguments

<gpio #>

Default

-1

Properties

Supported Platforms

Get example

> get http.server.ws_connected_gpio
-1

Set example

> set http.server.ws_connected_gpio 9
Set OK
> get gp u
!  # Description
...
#  9 http.server.ws_connected_gpio
...

http.server.ws_data_gpio

Abbreviation ht s y
Accessget/set

Description

The GPIO used to indicate whether a websocket stream has data available to read. It is asserted when one or more websocket streams have data to be read.

See also system.oob.gpio.

Note: Set to -1 to disable feature and free assigned GPIO.

Arguments

<gpio #>

Default

-1

Properties

Supported Platforms

Get example

> get http.server.ws_data_gpio
-1

Set example

> set http.server.ws_data_gpio 9
Set OK
> get gp u
!  # Description
...
#  9 http.server.ws_data_gpio
...