Skip to content
GoNetSim

HTTPS

Reference sheet for the HTTPS service

The HTTPS service simulates a basic web server. It extends the functionality of the HTTP service by adding TLS support. It has two modes of operation:

In “Fake” mode, requests to any URL will return a generic response with a configurable status code, headers and body.

Option Type Default Description
enabled bool true Whether the HTTPS service is enabled
listen string :443 The address and port to listen on (e.g. :443)
status int 200 The status code to return in “Fake” mode
mode string fake Which mode to use when serving files
root_dir string ./ Which directory to serve files from in “Real” mode
cert string "" The path to the TLS certificate file (PEM format). If empty, a self-signed certificate will be generated
key string "" The path to the TLS key file (PEM format). If empty, a self-signed key will be generated

To see instructions on how to configure these options, see the configuration guide.

The HTTPS service can be run on its own by passing it as a target to run:

Terminal window
gonetsim run https

This starts the HTTPS service with the current configuration, without starting any other services (Including the HTTP service; the HTTP service is not started with this command).

You can test the HTTPS service using curl.

  1. Start the HTTPS service

    Terminal window
    gonetsim run https
  2. In a separate terminal, make a request to the service using curl

    Terminal window
    curl -k https://localhost
  3. Return to the GoNetSim instance and you should see a log of the request in the output