Skip to content

Healthcheck Next.js guides

Expose simple unauthenticated /livez and /readyz routes for your orchestrator. Keep includeDetails false. Create a separate protected diagnostics route:

export const { GET, HEAD } = createNextHealthRoute(health, {
scope: "diagnostics",
includeDetails: true,
protect: { bearerToken: process.env.HEALTH_TOKEN! },
});

Do not combine bearer and Basic authentication. Only trust forwarded IP headers when a known reverse proxy overwrites them. Use secret comparison supplied by the factory, not query-string tokens.