Skip to content

v2.5.0: Reverse proxy for local development

Choose a tag to compare

@jdx jdx released this 10 Apr 10:55
· 162 commits to main since this release
Immutable release. Only release title and notes can be modified.
8911478

Pitchfork v2.5.0 introduces a built-in reverse proxy that gives your daemons stable, human-friendly HTTPS URLs for local development. Instead of remembering which port each service is running on (especially when ports get auto-bumped), you can access them through consistent slug-based URLs like api.localhost.

Added

  • Reverse proxy for local development -- The supervisor can now run an integrated reverse proxy that routes requests from slug-based URLs (e.g., api.localhost) to daemon ports. When a daemon's port changes (due to auto-bumping or restarts), the proxy URL stays the same. HTTPS is enabled by default with an auto-generated self-signed certificate. The proxy is opt-in and runs alongside the supervisor when enabled. (#293) - @gaojunran

    # pitchfork.toml
    [settings.proxy]
    enable = true
    # https = true        # default
    # port = 443          # default (requires sudo)
    # tld = "localhost"   # default
    # Register a slug for your project
    pitchfork proxy add api --daemon server
    
    # Start the supervisor (port 443 requires sudo)
    sudo pitchfork supervisor start --force
    
    # Your daemon is now reachable at <slug>.localhost
  • pitchfork proxy command family -- Four new subcommands for managing the proxy (#293) - @gaojunran:

    • pitchfork proxy add <slug> -- Register a slug mapping (with optional --dir and --daemon flags)
    • pitchfork proxy remove <slug> -- Remove a slug mapping (alias: rm)
    • pitchfork proxy status -- Show all registered slugs with their daemon status and proxy URLs
    • pitchfork proxy trust -- Install the auto-generated TLS certificate into the system trust store (macOS keychain or Linux CA directories)
  • Global slug registry -- Slug-to-daemon mappings are stored in the global config (~/.config/pitchfork/config.toml) under [slugs], providing a single source of truth that works across directories (#293) - @gaojunran:

    # ~/.config/pitchfork/config.toml
    [slugs]
    api = { dir = "/home/user/my-api", daemon = "server" }
    frontend = { dir = "/home/user/my-app", daemon = "dev" }
    docs = { dir = "/home/user/docs-site" }  # daemon defaults to "docs"
  • Custom TLS certificates -- Bring your own certificate (e.g., from mkcert) instead of using the auto-generated one (#293) - @gaojunran:

    [settings.proxy]
    enable = true
    tls_cert = "/path/to/cert.pem"
    tls_key = "/path/to/key.pem"
  • Configurable proxy TLD -- Use a custom TLD instead of the default localhost (requires wildcard DNS resolution, e.g., via dnsmasq) (#293) - @gaojunran

Full Changelog: v2.4.0...v2.5.0