You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously runtime OG image URLs were only signed when a `security.secret`
was configured; without one the `/_og/d/**` endpoint accepted arbitrary
unsigned requests. Now a per-build secret is auto-generated when none is set,
so URL signing is on by default with no configuration.
- Resolve the signing secret via a pure `resolveSigningSecret()`: explicit
opt-out (`secret: false`) > explicit config/env value > auto-generated.
- The auto value is random, server-only, and baked into the build. It is
stable within a build artifact (runtime sign + verify agree) but rotates per
build, so an explicit secret is still recommended for rolling/multi-instance
deploys — surfaced via a dev warning, gated on having a server runtime (no
warning for pure SSG/static builds).
- Only an explicit secret is baked into the `ogImage.secret` override channel,
keeping the `NUXT_OG_IMAGE_SECRET` runtime override (e.g. Cloudflare env)
reachable. The auto value lives solely in the build-time `security.secret`.
- `strict` still requires an explicit secret (the auto value's per-build
rotation isn't a strong enough guarantee).
- `security.secret: false` disables signing entirely.
Test fixtures that assert unsigned dynamic URLs (basic, cloudflare-satori,
vercel-edge-satori) opt out via `secret: false`; signing remains covered by the
url-signing unit tests and the cloudflare-runtime-config e2e.
When you configure a signing secret, every OG image URL includes a cryptographic signature in the path. The server verifies this signature before rendering, rejecting any URL that has been tampered with or crafted manually.
47
+
OG image URLs are signed by default. Every URL includes a cryptographic signature in the path, and the server rejects any runtime request whose signature is missing or invalid with a `403`. This prevents unauthorized image generation requests that would otherwise consume server resources.
48
48
49
-
This prevents unauthorized image generation requests that would otherwise consume server resources.
49
+
### Default: auto-generated secret
50
50
51
-
### Setup
51
+
When you do not configure a secret, the module generates a random one at build time, so signing works with no setup. The auto-generated secret **changes on every build**. That is fine for prerendered images (served as static files) and single-instance runtime deploys, but during a rolling or multi-instance deploy a URL signed by one build can fail verification on another.
52
+
53
+
For those deploys, set a stable secret so every instance shares the same value.
54
+
55
+
### Disabling signing
56
+
57
+
To serve unsigned runtime URLs (not recommended), set `secret` to `false`:
Copy file name to clipboardExpand all lines: docs/content/4.api/3.config.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -197,7 +197,7 @@ See the [Browser Renderer](/docs/og-image/renderers/browser) guide for more deta
197
197
198
198
Security limits for image generation. See the [Security Guide](/docs/og-image/guides/security) for full details.
199
199
200
-
-**`secret`**: Signing secret for URL tamper protection. When set, all runtime OG image URLs are signed and unsigned requests are rejected with `403`. Generate one with `npx nuxt-og-image generate-secret`. See the [Security Guide](/docs/og-image/guides/security#url-signing) for details.
200
+
-**`secret`**: Signing secret for URL tamper protection. Runtime OG image URLs are signed by default; unsigned requests are rejected with `403`. Leave unset to auto-generate a per-build secret, set an explicit stable string for rolling/multi-instance deploys, or `false` to disable signing. Generate one with `npx nuxt-og-image generate-secret`. See the [Security Guide](/docs/og-image/guides/security#url-signing) for details.
201
201
-**`maxDimension`**: Maximum width or height in pixels. Default `2048`.
202
202
-**`maxDpr`**: Maximum device pixel ratio (Takumi renderer). Default `2`.
203
203
-**`renderTimeout`**: Milliseconds before the render is aborted with a `408` response. Default `15000`.
logger.warn('`ogImage.debug` is enabled in production. This exposes the `/_og/debug.json` endpoint and should not be enabled in production. Disable it before deploying.')
0 commit comments