API Configuration

Configure YARP-based reverse proxy routing

ApiVersion uses YARP (Yet Another Reverse Proxy) routing configuration to define how requests are forwarded to backend services.

YARP Routes and Clusters

The parameters section in ApiVersion accepts YARP routing configuration with routes, clusters, and destinations.

Basic Proxy

Forward all requests to a backend:

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

Add authentication headers to proxied requests:

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

Configure HTTP connection behavior:

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 YARP. For advanced routing scenarios including path transformations, load balancing, and health checks, see the YARP documentation.

What’s Next