You can reserve a domain name so that it will never be assigned to another user, even if your tunnel is offline.
You can reserve a subdomain of the form sub.loclx.io
or a totally custom domain like example.com
.
Usage
Reserve a subdomain
loclx domain reserve --subdomain dev
This will reserve the domain dev.loclx.io
if you want to reserve in another region you need to pass --region ap
for example then the final domain will be dev.ap.loclx.io
.
Note that we advise to only reserve first-level subdomains like dev.loclx.io
, to avoid TLS issues.
For example reserving my.dev.loclx.io
may result in TLS warnings when users access it on different devices.
You always have the option of using your own custom tunnel domain instead of loclx.io
.
Reserve a custom domain
loclx domain reserve --domain example.com --region ap
The command above will reserve example.com
and it will return a DNS record that you need to add in your domain DNS settings. See the Create a Custom Domain Name (opens in a new tab) tutorial for more information.
One of the two flags --subdomain
or --domain
is required (but not both!)
Check if you configured your DNS correctly
loclx domain status --domain example.com
This command will check your DNS if configured correctly, it may take time to see your domain as verified
due to DNS propagation (opens in a new tab) time.
Create a Let's Encrypt certificate
Create a Let's Encrypt certificates for your reserved custom domain is simple with LocalXpose, you just need to run:
loclx domain letsencrypt --domain example.com
This will create a Let's Encrypt certificate and store it in your machine, then you can use the generated certificate in your TLS (opens in a new tab) tunnel.
Please make sure of the following:
- There is no running tunnel using the domain for which you want to issue a certificate
- The port 54538 is free.
Creating a Let's Encrypt certificate by hand is mostly useful for management of TLS tunnels. The HTTP tunnel command will automatically generate the certificate for you (and handle the renewal too.)
Wildcard custom domain
You can reserve a wildcard custom domain by doing
loclx domain reserve --domain '*.example.com'
Then you can start an HTTP/S or TLS tunnel with this reserved wildcard domain by running:
loclx tunnel http --reserved-domain '*.example.com` # or 'anything.example.com`
Read more about wildcard tunnel certs to create a wildcard cert for tunnels.