Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 3.12 KB

examples.md

File metadata and controls

48 lines (37 loc) · 3.12 KB

Examples

Complete, working KDL configs — each a real file you can download and run, not a fragment. Every file in examples/ passes --validate-configs as shown.

Try one

  1. Get a license file. See Licensing.

  2. Pick an example below and download it, or clone the file from examples/.

  3. If it needs TLS, generate a certificate and key for trying it out (never use this for production — it's a throwaway, self-signed pair):

    openssl req -x509 -newkey rsa:2048 -nodes -days 365 \
      -keyout key.pem -out cert.pem -subj "/CN=localhost"

    Run this in the same directory as the example file — the examples reference ./cert.pem and ./key.pem.

  4. Point Flow at your license file (export FLOW_LICENSE_FILE=/path/to/license.json is the simplest way; see Licensing for the full precedence) and run:

    flow --config-kdl <example-file>.kdl

The examples

File What it shows Needs
quickstart.kdl The simplest possible gateway — one route, plain HTTP, to a public backend (httpbin.org). The first thing to run. Nothing extra
tls-termination.kdl TLS in, plain HTTP to the backend. A cert/key pair
rest-api-gateway.kdl A fuller REST gateway: TLS, token authentication, rate limiting, and CORS together on one route. A cert/key pair, and your own identity provider to see a request succeed (every request gets 401 without one — that's the route working as designed)
dns-discovered-upstream.kdl A bare-hostname connector (DNS-discovered) combined with active health checking and a circuit breaker. Nothing extra
grpc-gateway.kdl A cleartext gRPC (h2c) gateway. See Non-REST protocols. Your own gRPC backend
grpcs-gateway.kdl gRPC over TLS, both hops. A cert/key pair, and your own gRPC backend
metrics-enabled.kdl A working gateway with the Prometheus metrics endpoint secured with TLS, bearer-token auth, and a source CIDR allowlist. A cert/key pair, and FLOW_METRICS_TOKEN set

Most examples route to httpbin.org, a public echo service — enough to see real traffic flow without standing up a backend first. Swap connectors for your own service whenever you're ready. The gRPC examples are the exception: httpbin doesn't speak gRPC, so those use a placeholder backend address instead.

Related