API Configuration

Configure YARP-based reverse proxy routing

The ApiVersion resource relies on YARP (Yet Another Reverse Proxy) routing configuration to define exactly how requests are forwarded to your backend services.

YARP routes and clusters

The parameters section in ApiVersion accepts standard YARP routing objects: routes, clusters, and destinations.

Basic proxy

The most common use case is forwarding all requests to a single backend address.

apiVersion: weik.io/v1alpha1
kind: ApiVersion
metadata:
  name: v1
spec:
  apiName: anonwebhook
  isActive: true
  parameters:
    routes:
      route2:
        clusterId: "cluster2"
        match:
          path: "{**catch-all}"
    clusters:
      cluster2:
        destinations:
          cluster2/destination1:
            Address: "https://webhook.site/99f574f3-a9c3-4723-aae3-ecb98cc4e395"

Authentication headers

A backend API often requires its own authentication that you want to hide from the caller. You can inject authentication headers into the proxied request before it is sent to the backend.

apiVersion: weik.io/v1alpha1
kind: ApiVersion
metadata:
  name: v1
spec:
  apiName: webhook
  isActive: true
  connection:
    automaticDecompression: GZip
  authentication:
    type: "header"
    parameters:
      headerX: "user"
      another-myHeader-xApi: "123testisn"
  parameters:
    routes:
      route:
        clusterId: "cluster"
        match:
          path: "{**catch-all}"
    clusters:
      cluster:
        destinations:
          cluster/destination1:
            Address: "https://api.example.com"

Connection settings

You can tune the HTTP connection behavior under connection. This is useful for backends that need specific redirect or cookie handling.

apiVersion: weik.io/v1alpha1
kind: ApiVersion
metadata:
  name: v1
spec:
  apiName: webhook
  isActive: true
  connection:
    automaticDecompression: GZip
    useProxy: false
    allowAutoRedirect: true
    useCookies: true
    connectTimeout: 00:00:30
  parameters:
    routes:
      route:
        clusterId: "cluster"
        match:
          path: "{**catch-all}"
    clusters:
      cluster:
        destinations:
          cluster/destination1:
            Address: "https://api.example.com"

YARP documentation

Weik.io APIM is built on Microsoft’s YARP. For advanced scenarios such as path transformations, load balancing strategies, or active health checks, you can write standard YARP configuration. Refer to the YARP documentation for the full list of supported properties.

Next steps