Proxy & HTTPS
lokl includes a built-in reverse proxy that provides automatic HTTPS for your services.
Basic Setup
Section titled “Basic Setup”proxy: domain: myproject.dev
services: frontend: command: pnpm dev port: 5173 subdomain: appThis makes the frontend available at https://app.myproject.dev.
How It Works
Section titled “How It Works”- Certificate Generation — lokl generates self-signed certificates for your domain
- Trust Store — Certificates are added to your system trust store
- DNS — Entries added to
/etc/hostsfor local resolution - Routing — Requests are proxied to the appropriate service based on subdomain
Subdomains
Section titled “Subdomains”Assign subdomains to services:
services: frontend: port: 5173 subdomain: app # → https://app.myproject.dev
api: port: 3000 subdomain: api # → https://api.myproject.dev
admin: port: 4000 subdomain: admin # → https://admin.myproject.devRoot Domain
Section titled “Root Domain”A service without a subdomain gets the root domain:
services: main: port: 3000 # No subdomain → https://myproject.devPath Rewriting
Section titled “Path Rewriting”For SPA routing or API prefixes:
services: api: port: 3000 subdomain: api rewrite: strip_prefix: /v1 fallback: /index.htmlDNS Management
Section titled “DNS Management”Setup DNS entries:
sudo lokl dns setupRemove DNS entries:
sudo lokl dns removeToggle Proxy
Section titled “Toggle Proxy”In the TUI, press p to toggle between:
- Local — Direct connection to service
- Remote — Through HTTPS proxy