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

    Variable SubrouteHandlerSchemaConst

    SubrouteHandlerSchema: ZodObject<
        {
            errors: ZodOptional<ZodAny>;
            handler: ZodLiteral<"subroute">;
            routes: ZodOptional<
                ZodArray<
                    ZodLazy<
                        ZodObject<
                            {
                                "@id": ZodOptional<ZodString>;
                                handle: ZodArray<
                                    ZodType<
                                        { handler: string; [key: string]: unknown },
                                        ZodTypeDef,
                                        { handler: string; [key: string]: unknown },
                                    >,
                                    "many",
                                >;
                                match: ZodOptional<
                                    ZodArray<
                                        ZodObject<
                                            {
                                                client_ip: ...;
                                                expression: ...;
                                                file: ...;
                                                header: ...;
                                                header_regexp: ...;
                                                host: ...;
                                                method: ...;
                                                not: ...;
                                                path: ...;
                                                path_regexp: ...;
                                                protocol: ...;
                                                query: ...;
                                                remote_ip: ...;
                                                tls: ...;
                                            },
                                            "strip",
                                            ZodTypeAny,
                                            {
                                                client_ip?: ...;
                                                expression?: ...;
                                                file?: ...;
                                                header?: ...;
                                                header_regexp?: ...;
                                                host?: ...;
                                                method?: ...;
                                                not?: ...;
                                                path?: ...;
                                                path_regexp?: ...;
                                                protocol?: ...;
                                                query?: ...;
                                                remote_ip?: ...;
                                                tls?: ...;
                                            },
                                            {
                                                client_ip?: ...;
                                                expression?: ...;
                                                file?: ...;
                                                header?: ...;
                                                header_regexp?: ...;
                                                host?: ...;
                                                method?: ...;
                                                not?: ...;
                                                path?: ...;
                                                path_regexp?: ...;
                                                protocol?: ...;
                                                query?: ...;
                                                remote_ip?: ...;
                                                tls?: ...;
                                            },
                                        >,
                                        "many",
                                    >,
                                >;
                                priority: ZodOptional<ZodNumber>;
                                terminal: ZodOptional<ZodBoolean>;
                            },
                            "strip",
                            ZodTypeAny,
                            {
                                "@id"?: string;
                                handle: { handler: string; [key: string]: unknown }[];
                                match?: {
                                    client_ip?: (...) | (...);
                                    expression?: (...) | (...);
                                    file?: (...) | (...);
                                    header?: (...) | (...);
                                    header_regexp?: (...) | (...);
                                    host?: (...) | (...);
                                    method?: (...) | (...);
                                    not?: (...) | (...);
                                    path?: (...) | (...);
                                    path_regexp?: (...) | (...);
                                    protocol?: (...) | (...);
                                    query?: (...) | (...);
                                    remote_ip?: (...) | (...);
                                    tls?: (...) | (...);
                                }[];
                                priority?: number;
                                terminal?: boolean;
                            },
                            {
                                "@id"?: string;
                                handle: { handler: string; [key: string]: unknown }[];
                                match?: {
                                    client_ip?: (...) | (...);
                                    expression?: (...) | (...);
                                    file?: (...) | (...);
                                    header?: (...) | (...);
                                    header_regexp?: (...) | (...);
                                    host?: (...) | (...);
                                    method?: (...) | (...);
                                    not?: (...) | (...);
                                    path?: (...) | (...);
                                    path_regexp?: (...) | (...);
                                    protocol?: (...) | (...);
                                    query?: (...) | (...);
                                    remote_ip?: (...) | (...);
                                    tls?: (...) | (...);
                                }[];
                                priority?: number;
                                terminal?: boolean;
                            },
                        >,
                    >,
                    "many",
                >,
            >;
        },
        "strip",
        ZodTypeAny,
        {
            errors?: any;
            handler: "subroute";
            routes?: {
                "@id"?: string;
                handle: { handler: string; [key: string]: unknown }[];
                match?: {
                    client_ip?: { ranges?: (...) | (...) };
                    expression?: string;
                    file?: {
                        fs?: (...) | (...);
                        root?: (...) | (...);
                        split_path?: (...) | (...);
                        try_files?: (...) | (...);
                        try_policy?: (...) | (...);
                    };
                    header?: Record<string, (...)[]>;
                    header_regexp?: Record<string, (...) | (...)>;
                    host?: string[];
                    method?: string[];
                    not?: Record<(...), (...)>[];
                    path?: string[];
                    path_regexp?: { name?: (...) | (...); pattern: string };
                    protocol?: string;
                    query?: Record<string, (...)[]>;
                    remote_ip?: { ranges?: (...) | (...) };
                    tls?: { handshake_complete?: (...) | (...) | (...) };
                }[];
                priority?: number;
                terminal?: boolean;
            }[];
        },
        {
            errors?: any;
            handler: "subroute";
            routes?: {
                "@id"?: string;
                handle: { handler: string; [key: string]: unknown }[];
                match?: {
                    client_ip?: { ranges?: (...) | (...) };
                    expression?: string;
                    file?: {
                        fs?: (...) | (...);
                        root?: (...) | (...);
                        split_path?: (...) | (...);
                        try_files?: (...) | (...);
                        try_policy?: (...) | (...);
                    };
                    header?: Record<string, (...)[]>;
                    header_regexp?: Record<string, (...) | (...)>;
                    host?: string[];
                    method?: string[];
                    not?: Record<(...), (...)>[];
                    path?: string[];
                    path_regexp?: { name?: (...) | (...); pattern: string };
                    protocol?: string;
                    query?: Record<string, (...)[]>;
                    remote_ip?: { ranges?: (...) | (...) };
                    tls?: { handshake_complete?: (...) | (...) | (...) };
                }[];
                priority?: number;
                terminal?: boolean;
            }[];
        },
    > = ...

    Subroute handler schema - nested route handling

    Groups routes together for organization and conditional execution. Commonly used for path-prefixed sections or error handling.

    const handler = SubrouteHandlerSchema.parse({
    handler: "subroute",
    routes: [
    {
    match: [{ path: ["/api/*"] }],
    handle: [{ handler: "reverse_proxy", upstreams: [{ dial: "localhost:3000" }] }]
    },
    {
    handle: [{ handler: "static_response", status_code: 404 }]
    }
    ]
    });