Sometimes you need to start multiple tunnels at once, without starting multiple loclx processes. The yaml config file will let you do that.

You can create a sample config file any then modify it to suit your needs:

# create a sample config file in the current working directory
loclx tunnel config init

The resulting YAML file will look much like the following:

dev:
  type: http
  region: us
  to: localhost:9090
 
ssh:
  type: tcp
  region: us
  port: 7676
  to: localhost:22
  plugins:
    ip_whitelist:
      - 127.0.0.1
 
portal:
  type: http
  subdomain: hello
  region: us
  to: localhost:8080
  plugins:
    basic_auth: user:pass
    ip_whitelist:
      - 127.0.0.1
      - 192.0.2.0/24
 
chat:
  type: tls
  subdomain: secure
  region: us
  to: localhost:2090
 
work:
  type: http
  region: us
  to: localhost:9090
  plugins:
    request_header:
      - host:mydomain.com
      - X-Token:secureToken
    response_header:
      - role:admin
 
file-server:
  type: http
  region: us
  reserved_domain: mydomain.com
  apps:
    file_server:
      path: ./

After modifing the config file you can start multiple tunnels as follow:

loclx tunnel config -f /path/to/config.yaml

Config file syntax

dev: # give your tunnel a name so you can identify it later in the terminal
  type: http # tunnel type
  to: localhost:80 # the localhost service address
  region: us # region name to start a tunnel at, possible values (us, ap and eu)
  subdomain: hello # a temporary subdomain that your tunnel will be accessible at
  reserved_domain: hello.example.com # if you have a reserved subdomain or custom domain it should be here
  plugins: # the middlewares that you wanna use for this tunnel, read more here https://localxpose.io/docs/tunnels/http/http-middlewares
    https_redirect: true # redirect http requests to https
    basic_auth: user:pass # use basic authentication to access the tunnel
    ip_whitelist: 127.0.0.1,82.87.12.199 # only allow specific ip adresses to access
    request_header: # edit request headers before forwarding the traffic to your service
      - host:mydomain.com
      - X-Token:secureToken
    response_header: # edit response headers before forwarding the traffic to your service
      - role:admin
    prefix_path: /api # prefix the URL path before reaching your localhost service
    rate_limit: 20 # limit the incoming requests to 20/s
    key_auth: secure_toke # protect the tunnel with a key authentication
 
ssh:
  type: tcp
  to: localhost:22
  region: ap
  port: 2233 # temporary port number
  reserved_endpoint: us.loclx.io:2255 # if you have a reserved endpoint
 
  ftps:
    type: tls
    to: 21
    crt: /path/to/crt # path to your TLS certificate
    key: /path/to/key # path to your TLS key

8 The Green, Dover, Delaware, 19901 USA

hello@localxpose.io

2025 Freeport Cloud, Inc. All rights reserved.

Learn how we use cookies.

We contribute to Stripe's Climate program!

Product

FeaturesPricingDocumentationAppsAlternatives