Search…
Config.yaml
Start multiple tunnels from a config file
Sometimes you need to start mulitple tunnels at once without starting loclx instance multiple times, with a yaml config file you can do that.
You can create a sample config file so that you can change it to your needs:
# create a sample config file in the current working directory
loclx tunnel config init
the above command will generate a sample config.yaml file like the below one
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.168.100.21/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:

config.yaml
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-s-middlewares
https_redirect: true # redirect http requests to https
basic_auth: user:pass # use baisc 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
Last modified 1mo ago
Copy link