lahyer.json

Configure redirects, response headers and cron jobs from a file in your repository.

Put a lahyer.json file in your app's root directory: the repository root, or the Root directory set on the project. Lahyer reads it on every build and applies it to that deployment, so the rules travel with your code and a preview tries them before they reach production.

lahyer.json
{
  "redirects": [
    { "source": "/blog/:slug", "destination": "/posts/:slug", "permanent": true }
  ],
  "headers": [
    {
      "source": "/assets/(.*)",
      "headers": [{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }]
    }
  ],
  "crons": [{ "path": "/api/cron/report", "schedule": "0 8 * * *" }]
}

The build log says what Lahyer found, for example Using lahyer.json: 1 redirect, 1 header rule, 1 cron job.

Fields

FieldWhat it holds
redirectsUp to 100 rules that send a path somewhere else. See Redirects.
headersUp to 100 rules that add response headers. See Headers.
cronsUp to 20 paths of your app for Lahyer to call on a schedule. See Cron jobs.
$schemaAllowed so editors can offer completion; Lahyer ignores it.

Every field is optional. Any other field fails the build, so a typo never goes unnoticed.

Path patterns

The source of redirects and header rules is a path pattern:

PatternMatches
/aboutExactly /about
/blog/:slugOne segment: /blog/hello, but not /blog/2026/hello
/blog/:page?An optional segment: /blog and /blog/2
/docs/:path*Zero or more segments: /docs, /docs/a and /docs/a/b
/docs/:path+One or more segments: /docs/a and /docs/a/b, but not /docs
/(.*)Every path
/(en|fr)/about/en/about and /fr/about

Matching ignores letter case and a trailing slash. A redirect's destination can reuse what the source matched: :slug by name, and (...) groups as $1, $2 in order.

Patterns are deliberately simpler than regular expressions: only the (.*) group and lists of words such as (en|fr) are accepted, because hand-written regular expressions are hard to read and can be slow to match.

When the file has a problem

If lahyer.json is not valid JSON or a rule is refused, the build fails and the log lists every problem with where it is, for example:

redirects.0.source: source must start with /
headers.1.headers.0.key: this header is managed by the platform

The live deployment keeps serving until a build succeeds.

On this page