Overview
Theproxy command controls the Portless proxy server lifecycle. The proxy runs as a background daemon and routes requests from .localhost URLs to your local dev servers.
Syntax
Subcommands
start
Start the proxy server in the background.
- Listens on port 1355 (no sudo required)
- Runs as a daemon (background process)
- Logs to
~/.portless/proxy.logor/tmp/portless/proxy.log
stop
Stop the running proxy server.
SIGTERM to the proxy process and cleans up state files.
Options
--port <number>, -p <number>
Specify the port for the proxy to listen on. Must be between 1 and 65535.
--https
Enable HTTP/2 with TLS using auto-generated certificates.
- Generates a local CA certificate
- Attempts to add CA to system trust store
- Generates a wildcard certificate for
*.localhost
--cert <path>
Use a custom TLS certificate. Must be used with --key. Implies --https.
-----BEGIN CERTIFICATE-----.
--key <path>
Use a custom TLS private key. Must be used with --cert. Implies --https.
-----BEGIN PRIVATE KEY----- or similar.
--no-tls
Disable HTTPS even if PORTLESS_HTTPS environment variable is set.
--foreground
Run the proxy in the foreground instead of as a daemon. Useful for debugging.
Examples
Basic Start
Start with HTTPS
Start on Port 80 (Requires Sudo)
http://myapp.localhost (no port in URL).
Start on Port 443 with HTTPS (Requires Sudo)
https://myapp.localhost (standard HTTPS port).
Use Custom Certificates
Stop the Proxy
Debug Mode (Foreground)
Auto-Start
The proxy auto-starts when you run an app withportless run or portless <name>:
- Port < 1024: Prompts for sudo permission
- Port >= 1024: Starts silently without sudo
skip when prompted.
State Directory
The proxy stores state in a directory that depends on the port:- Port < 1024 (privileged):
/tmp/portless - Port >= 1024 (unprivileged):
~/.portless
PORTLESS_STATE_DIR environment variable.
State files:
proxy.pid- Process ID of the running proxyproxy.port- Port the proxy is listening onproxy.tls- Marker file (exists if HTTPS is enabled)proxy.log- Proxy logs (daemon mode only)routes.json- Active routesca.pem,ca-key.pem- Local CA (if using —https)cert.pem,key.pem- Wildcard certificate (if using —https)
Errors
Port Already in Use
Permission Denied (Privileged Port)
Already Running
Invalid Certificate
Missing —cert or —key
HTTP/2 Benefits
Enabling HTTPS with--https enables HTTP/2, which provides:
- Connection multiplexing - All requests over a single connection
- Faster page loads - Eliminates HTTP/1.1’s 6-connection limit
- Better for dev servers - Vite, Nuxt, and other unbundled servers benefit most
--https or provide custom certificates.
Related Commands
portless run- Run an app (auto-starts proxy)portless list- Show active routesportless trust- Trust the local CA
Exit Codes
- 0 - Success
- 1 - Error (port in use, permission denied, invalid arguments, failed to start)