@accelerated-software-development/caddy-api-client - v0.2.2
    Preparing search index...

    Function buildMitmproxyRoute

    • Build a route that forwards traffic through MITMproxy for inspection

      This is a convenience function that creates a route pointing to a MITMproxy instance running in reverse proxy mode. Use this to transparently intercept and inspect HTTP traffic for debugging without modifying client or backend code.

      Parameters

      • options: {
            backendHost?: string;
            backendPort?: number;
            host: string;
            id?: string;
            mitmproxyHost: string;
            mitmproxyPort?: number;
            priority?: number;
        }

        MITMproxy route configuration

        • OptionalbackendHost?: string

          Backend host that MITMproxy should forward to (optional, for documentation)

        • OptionalbackendPort?: number

          Backend port that MITMproxy should forward to (optional, for documentation)

        • host: string

          Host pattern to match (e.g., "api.example.com")

        • Optionalid?: string

          Route ID for Caddy (optional)

        • mitmproxyHost: string

          MITMproxy host (e.g., "localhost" or "mitmproxy-container")

        • OptionalmitmproxyPort?: number

          MITMproxy proxy port (default: 8080)

        • Optionalpriority?: number

          Route priority (optional)

      Returns CaddyRoute

      Caddy route configured to forward through MITMproxy

      // Route traffic for api.example.com through MITMproxy
      const route = buildMitmproxyRoute({
      host: "api.example.com",
      mitmproxyHost: "localhost",
      mitmproxyPort: 8080,
      });
      await client.addRoute("https_server", route, "api_debug");
      // Route with custom backend (MITMproxy forwards to this backend)
      const route = buildMitmproxyRoute({
      host: "api.example.com",
      mitmproxyHost: "mitmproxy",
      mitmproxyPort: 8080,
      backendHost: "backend-service",
      backendPort: 3000,
      });