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 should be forwarded to your backend services.

YARP Routes and Clusters

If you’ve used YARP before, you’ll feel right at home. The parameters section in ApiVersion accepts standard YARP routing objects: routes, clusters, and destinations.

Basic Proxy

The most common use case is simply catching everything and throwing it to a 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"

With Authentication Headers

Often, the backend API requires its own authentication that you want to abstract away from the caller. You can inject authentication headers into the proxied request before it goes out.

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 directly under connection. This is useful when dealing with stubborn legacy 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

We built Weik.io APIM on Microsoft’s YARP. For anything complicated—like 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.

What’s Next