#564

--unprivileged --https proxy comes back as plain HTTP after it stops

Opendrewbittopened 7d ago

Version

0.16.0 (also on main, 49586cf)

Steps to reproduce

  1. portless proxy start --unprivileged --https
  2. portless proxy stop (killing the proxy does the same)
  3. portless run next dev, or anything else that auto-starts the proxy

Expected behavior

The auto-started proxy uses HTTPS on 443 again. The docs say unprivileged mode is remembered for auto-start, and --https is how you keep HTTPS in that mode.

Actual behavior

It starts a plain HTTP proxy on port 80, so apps get http:// URLs. --unprivileged survives the restart and --https doesn't.

The exit cleanup resets proxy.tls (cli.ts#L1078) but keeps proxy.unprivileged, and unprivileged mode falls back to HTTP unless HTTPS is passed explicitly (cli.ts#L310). PORTLESS_HTTPS=1 works around it.

With --idle-exit from #563 this would happen on every cycle.

Environment

macOS 27.2, Node 26.13.0

Activity

1
Knat-Dev6d ago

Thanks for the clear repro and for tracing it to the cleanup. Reproduced on main (49586cf) with both proxy stop and a SIGTERM: after the exit proxy.tls is gone while proxy.unprivileged stays, so the next portless run comes up as plain HTTP on port 80.

For #563, the latest commit (4f5f757) makes an idle exit keep the remembered port, TLS, TLD and LAN settings, so the idle-exit cycle won't hit this.

For a regular stop, I'll open a small fix that keeps the TLS setting together with the unprivileged marker, so --unprivileged --https comes back as HTTPS on 443. Until then, PORTLESS_HTTPS=1 is the right workaround.