Skip to content

Releases

1.0.0-beta.2

1.0.0-beta.2 Pre-release
Pre-release

Choose a tag to compare

@ethlo ethlo released this 24 Nov 11:27
eaf0a7a

Upgrade notes

Upgrade the gateway, tailer and reaper together. The journal gains fields: whether a body was capped, and whether r7 relayed the upstream's head. A beta.1 tailer reading a beta.2 journal fails silently: it writes a capped body to WARC as if it were whole, and writes r7's own 502 as if the upstream had sent it. The tailer also changes how it stores bodies and frees native memory it used to leak (below), so a beta.1 tailer must not be kept.

Licence: r7 is Apache 2.0 from this release. The BSL no longer applies to any module (#283).

Check your config before you deploy: docker run --rm --env-file .env -v "$PWD/routes.yaml:/app/config/routes.yaml:ro" ghcr.io/ethlo/r7-gateway:1.0.0-beta.2 --validate-only. beta.1 files need these changes:

beta.1 beta.2
global_filters: filters: at the root of routes.yaml. It is one instance for everything beneath it, as group and route filters are.
journal.request.status_overrides / journal.response.status_overrides An on_response rule: - match: [{ Status: { include: [401, 403, 5xx] } }] then request: { level: HEADERS } (see docker/config/routes.yaml and docs/journaling.md).
$${name} for a named group in RewritePath and TemplateRedirect {name}, with \{ for a literal brace. The old form is refused with a message saying so.
TemplateRedirect status set to any code 301, 302, 303, 307 or 308 only.
Host hosts: ["a,b"] matched the literal a,b A comma now separates hosts, so hosts: ["${HOST_LIST}"] works.
CircuitBreaker in the root's or a group's filters Declare it on each route it protects; above route level it is refused.
StaticContent base_directory: /var/www directories: [/var/www]. Several directories are checked in order, the first that has the file answering (#261).
leg on a request predicate (Path, RequestHeader, RemoteAddr, ...) Drop it. Request predicates always test the request as the client sent it; only response predicates (Status, HasResponseHeader, MatchResponseHeader) take leg.
Several RewritePaths on a route, one of them setting the query Refused. A query-setting rewrite must be the only RewritePath the route runs, counting the root's and the group's (#255).
RequireAuthorizationHeader Removed: it checked only the Bearer /Basic prefix and authenticated nothing. Use BasicAuth, or RequireMatchRequestHeader with name: Authorization for a prefix check.
RemoveCacheHeaders Removed. RemoveRequestHeader for If-Modified-Since and If-None-Match, SetRequestHeader for Cache-Control and Pragma.
StaticContent list_directory Removed: a directory without a welcome file is answered 403.
json.bodies: true / json.bodies: false in tailer.yaml inline / none, or files for body files. The boolean is refused with what replaced it (#287).
JwtAuth issuer and jwks_url, one issuer Unchanged. For several issuers use issuers: instead; the two forms cannot be mixed (#285).
BasicAuth's gateway.auth.basic.user attribute, a fingerprint of the username The JSON line's identity object, in plain text: {"scheme": "basic", "subject": "alice", "username": "alice"} (#264).

The old keys are reported as plain unknown options.

Security

  • A rewritten path is checked before it is forwarded (#254). A RewritePath with {query.NAME} in the path could forward a .. segment that r7 refuses from clients: /files/{query.name} with ?name=..%2Fadmin reached the upstream as /files/../admin. Every path a filter changes now gets the same ambiguity check, and fails with 400.
  • Plugin code runs with the gateway's rights. The docs now say to keep the plugins directory read-only to the gateway.

Configuration

  • JwtAuth verifies a Bearer JWT against a JWKS endpoint. issuer and audience are required, only RS, PS and ES signatures are accepted, a JWKS outage is answered with 503, and forward_claims_as_headers passes claims to the upstream (#264). Client spellings of the forwarded headers (X_User_Name and the like) are removed before the verified value is set.
  • JwtAuth takes several issuers with issuers:, such as one Keycloak with a realm per tenant (#285). A token's iss is matched exactly against the list before any key is fetched, so an unknown issuer gets 401 with no network call. Each issuer has its own JWKS URL (default: the issuer plus /protocol/openid-connect/certs) and its own key cache; one issuer's outage answers 503 only for its own tokens. forward_claims_as_headers can forward iss, so upstreams key on issuer and subject.
  • Root, group and route levels in routes.yaml (#238). A group's match is tested once before its routes. Filters at a level are one instance for everything beneath it. Upstream keys are inherited key by key. Routes that take all their upstream keys from one declaration share one connection pool and health state (#240).
  • --validate-only checks the config the way a start would, without starting the gateway (#230).
  • upstream.preserve_host forwards the client's Host (#234).
  • RewritePath can set the query with {query.NAME} and captures (#236). TemplateRedirect can take query values, and source is optional (#232).
  • Response predicates Status, HasResponseHeader and MatchResponseHeader, with leg: client|upstream to test the response the client got or the one the upstream sent, and Sample for canaries (#241, #242). Request predicates test the request as the client sent it and take no leg (#260).
  • CircuitBreaker judges upstream outcomes when the exchange completes, and adds slow_call (#231). A CircuitBreaker belongs on a route: at the root or on a group it is refused (#256, #258).
  • Filter factories declare where they apply (#258). A filter factory's levels() names the levels it may be declared on, defaulting to all, so existing plugins load unchanged.
  • StaticContent serves from several directories, the first that has the file answering (#261), and takes a fallback file such as index.html for single-page apps (#263). A file or folder the gateway may not read answers 403 with one warning per directory naming the path; it no longer looks absent, and lower directories are not tried in its place (#273).
  • Plugins: jars in plugins/ (or R7_PLUGINS_DIR, /app/plugins in the image), with one class loader per plugin directory (#226, #245).

Journal

  • Journal rules: on_request and on_response at the root, on a group or on a route replace status_overrides. The first matching rule per stage wins, and its id is journaled as gateway.journal.rule (#244).
  • truncate_body_at caps the journaled body per direction. Traffic still streams whole. WARC marks capped records WARC-Truncated: length, and the JSON line marks them body_truncated: true (#246).
  • Silent routes write nothing, and the management view shows rule_errors (#247). Unrouted on_request rules take the UnroutedReason predicate (#248).
  • The caller's identity is journaled in plain text: the JSON line's identity holds the scheme, issuer, subject and username that BasicAuth or JwtAuth verified. Plugins set it through Identity in r7-api, and read claims through Claims (#264).
  • No made-up upstream response. When no upstream answered, the journal records no upstream response instead of r7's own 502/503/504 (#229).
  • The response is finalised in one place at commit, for short circuits and static content too (#243).
  • The upstream request is journaled as it was sent (#265). The upstream_request leg holds the request line and headers the relay wrote, including the rewritten Host, X-Forwarded-* and the target's path. Status lines come from a table covering every registered code, so a 101 or 307 no longer reads "Unknown".
  • Standard protocol headers are journaled in plain text (#266): conditional and content headers, CORS preflight names, WebSocket version and extensions, and response caching and policy headers. Anything that can carry a credential stays fingerprinted (Referer, Sec-WebSocket-Protocol, Content-Security-Policy, Location).

Tailer

  • Body files (#287). json.bodies is none, inline or files. With files, each body the WARC output does not store is compressed as one Zstandard frame into rotating .bodies.zst files, and each client leg of the JSON line gets a body_ref with file, offset and length. A body is stored once per file by SHA-256. Bodies are appended before the line and taken back if the line fails. files is refused beside a WARC output that stores bodies. The tailer image prepares /bodies. There is no retention or deletion of body files.
  • WARC on standard output (#288). When a line may have reached standard output despite a reported failure, the tailer keeps its WARC records, per exchange across interleaved retries, so the retry never duplicates or loses an exchange.
  • Native memory leak fixed (#289). The tailer leaked one zstd decompression context per decode, so native memory grew until the container was OOM-killed while the JVM heap stayed flat. The context now lives for the tailer's life and is closed on shutdown. Anonymous RSS stays flat over 30,000 write-and-tick cycles. Every tailer running beta.1 under load is affected.
  • Loading into ClickHouse (#291). The where-r7-fits snippet ships the JSON lines to ClickHouse unparsed and lets ClickHouse parse them, which takes far less Vector CPU. migrations/ has a materialized view that loads the lines into an existing gateway log table in the shape it already uses.

Fixes

  • SimpleMetrics counts a request as proxied only when it reached an upstream (#253).
  • **A GET costs about 30% less CPU (#2...
Read more

1.0.0-beta.1

1.0.0-beta.1 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 11 Oct 12:41
124b8cd

The first beta of r7, the gateway that remembers every request.

r7 routes traffic to your services and records every exchange on local disk, with no network call while the client waits. One routes.yaml, strictly validated before it serves a single request.

What's in it

  • Every exchange on record. Metadata, headers or full bodies, chosen per route and per direction. Secrets are stored as keyed fingerprints, never in the clear.
  • Sidecars for the journal. The tailer turns the journal into WARC files (with an optional CDXJ index) and JSON lines; the reaper deletes segments once the tailers are done with them.
  • Performance you can measure. 2.3–2.9× the throughput of Spring Cloud Gateway on the same cores, reproducible with one command. See the [benchmarks](https://r7.ethlo.com/benchmarks/).
  • Extensions in plain Java. Each stage of a request has its own interface, alongside 33 built-in filters and 15 predicates.
  • Configuration you can trust. A full schema with precise errors, and hot reload that rejects a bad edit while your routes keep running.
  • Operable from day one. A dashboard, Prometheus /metrics, /health and /ready on the management port.

Images

ghcr.io/ethlo/r7-gateway:1.0.0-beta.1
ghcr.io/ethlo/r7-tailer:1.0.0-beta.1
ghcr.io/ethlo/r7-reaper:1.0.0-beta.1

Pre-releases never get latest or other floating tags. Pin the exact version.

Getting started

The [quickstart](https://r7.ethlo.com/quickstart/) has you running in five minutes.

Before 1.0

This is a beta. The configuration and the journal format can still change between betas; each change will be called out in the release notes. Feedback and issues are very welcome.