HTTP endpoint

HTTP endpoint is a listening point where the Tunnelize server listens for incoming HTTP requests. It allows clients to tunnel local HTTP traffic through the Tunnelize server.

Tunnels configured to forward HTTP traffic first connect to the server where they get assigned a domain to where a client can connect to through a browser to access the local HTTP server.

When a client first connects to the HTTP endpoint, server uses the Host header to decide to which tunnel it needs to connect to. After tunnel is found, a link is established between client and tunnel and data is forwarded until either side closes the connection.

Configuring endpoint

Default HTTP endpoint configuration looks like this:

{
    "server":{
        // ...other fields
        "endpoints":{
            "http-endpoint": {
                "type": "http",
                "port": 3457,
                "hostname_template": "tunnel-{name}.localhost"
            }
        }
    }
    
}

Fields:

FieldDescriptionDefault Value
typeThe type of the connection. Always http for http endpoint.No default
portThe port number for the connectionNo default
encryptionThe type of encryption used to enable HTTPS. See configuring encryption.No encryption
addressThe address for the connection to bind to.0.0.0.0
max_client_input_wait_secsMaximum amount of seconds on how long to wait between start of TCP connection and first request being sent.300
hostname_templateTemplate for the hostname to use when generating a hostname. See configuring templates below.No default
full_url_templateTemplate for the full URL to use when returning it to the tunnel. See configuring templates below.Automatic generation if not set.
allow_custom_hostnamesWhether custom hostnames are allowed. See configuring templates below.true
require_authorizationWhether authorization is required. See configuring authorization below.No authorization required

Configuring templates

For HTTP endpoints you can set templates to define how an URL will will be generated for a tunnel. There are two templates you can set:

{
    // ...other fields
    "hostname_template": "tunnel-{name}.localhost",
    "full_url_template": "http://{hostname}:{port}",
}

Setting hostname_template is required and that template will let HTTP endpoint generate a random name for the tunnel in the {name} part or use a custom name if allow_custom_hostnames is set.

When using allow_custom_hostnames name defined, desired_name defined in the tunnel proxy configuration for HTTP tunnel will be used unless it is already taken. If its already taken, a similar name will be autogenerated.

Setting full_url_template is useful if you are using tunnelize server behind something like an nginx or Apache, where the HTTP endpoint port is not the same for client as it is the same for nginx or Apache. This will allow you to set the template you wish server to return to the tunnel after registration. Parameter {hostname} will be replaced by name generated by hostname_template and {port} with the port in HTTP endpoint (or you can omit this or set your own port if needed).

Configuring authorization

If you do not wish everyone to see your local tunnel while it is running, you can set an authorization where user needs to enter an username and password in the browser to access your tunnel.

Set this configuration for that:

{
    "require_authorization": {
        "realm": "exampleRealm",
        "username": "user123",
        "password": "pass123",
    }
}

Here is the breakdown of the parameters:

ParameterDescriptionExample Value
realmA string that specifies the protection space. It is used to define the scope of protection for the browser. This field is not required."exampleRealm"
usernameThe username required for authentication."user123"
passwordThe password required for authentication."pass123"

Working with existing HTTP server

If you are using a http server like Apache or nginx it is possible to make tunnelize work with it. See links below for your http server: