Configuration

Portless is configured through environment variables. No config files needed.

Environment variables

VariableDescriptionDefault
PORTLESS_PORTProxy port443 (HTTPS) / 80 (HTTP)
PORTLESS_HTTPSHTTPS on by default; set to 0 to disable (same as --no-tls)on
PORTLESS_TLDUse a custom TLD instead of .localhost (e.g. test)localhost
PORTLESS_APP_PORTUse a fixed port for the app (skip auto-assignment)random 4000--4999
PORTLESS_SYNC_HOSTSSet to 1 to auto-sync /etc/hosts (auto-enabled for custom TLDs)off
PORTLESS_STATE_DIROverride the state directorysee below
PORTLESSSet to 0 to bypass the proxyenabled

State directory

Portless stores state (routes, PID file, port file, TLS marker) in a directory that depends on the proxy port:

ConditionPath
Port below 1024 (sudo, macOS/Linux)/tmp/portless
Port 1024+ (no sudo)~/.portless
Windows (any port)~/.portless

Override with PORTLESS_STATE_DIR.

State files

FilePurpose
routes.jsonMaps hostnames to ports
routes.lockPrevents concurrent writes
proxy.pidPID of the running proxy
proxy.portPort the proxy is listening on
proxy.logProxy daemon log output

Port assignment

Apps get a random port in the 4000--4999 range. Portless sets PORT and HOST before running your command. Most frameworks respect PORT automatically. For frameworks that ignore it (Vite, Astro, React Router, Angular, Expo, React Native), portless auto-injects --port and --host flags.