Skip to content

Web service setup

HTTP Service Configuration

The http section allows you to configure unencrypted HTTP services. You can define multiple HTTP services by adding more objects to the array.

json
"http": [
    {
        "port": 8080,
        "basic_auth": false,
        "username": null,
        "password": null,
        "skin": "demo_api"
    }
]

HTTP Options

OptionValuesDescription
port (required)1-65535TCP port number for the HTTP service
basic_authtrue, falseEnables/disables HTTP Basic Authentication
username (if basic auth)null or stringUsername for HTTP Basic Authentication
password (if basic auth)null or stringPassword for HTTP Basic Authentication
skinskin folder nameWeb interface theme

HTTPS Service Configuration

The https section configures encrypted HTTPS services. Like HTTP, you can define multiple HTTPS services.

json
"https": [
    {
        "port": 8443,
        "basic_auth": false,
        "username": "admin",
        "password": "admin",
        "skin": "default_apache",
        "country_name": "",
        "state_or_province_name": "",
        "locality_name": "",
        "organization_name": "Example",
        "common_name": "example.com",
        "key": "trapster/data/ssl/key.pem",
        "certificate": "trapster/data/ssl/certificate.pem"
    }
]

HTTPS Options

All HTTP options apply, plus these additional SSL/TLS-specific options.

If no SSL key/certificate is specified or the files don't exist, Trapster will automatically generate self-signed certificates. But you can also provide your own valid certificates.

OptionValuesDescription
country_namenull or stringTwo-letter country code (e.g., "US", "GB") for SSL certificate
state_or_province_namenull or stringState or province for SSL certificate
locality_namenull or stringCity or locality for SSL certificate
organization_namenull or stringOrganization name for SSL certificate (e.g., "My Company Ltd")
common_name (required)stringDomain name for SSL certificate (e.g., "example.com")
key (required)stringPath to SSL private key file (PEM format) (will be generated if the file doesn't exist)
certificate (required)stringPath to SSL certificate file (PEM format) (will be generated if the file doesn't exist)

Skin or templates

The skin option allows you to specify the skin or template to use for the web service.

It is a folder name in the trapster/data/http directory.

By default, Trapster comes with a few skins:

  • default_apache : Default Apache web server page
  • default_nginx : Default Nginx web server page
  • fortigate: Fortigate login page emulation
  • demo_api : A simple demo API to showcase the Trapster Web Framework capabilities
  • demo_ai : A demo showcasing AI-powered dynamic responses

But you can also create your own skins. For more information, please refer to the YAML Templates documentation.