The HTTP Cron runner that knows when a retry is dangerous.
Idempotent GET /health checks should be retried aggressively. Non-idempotent POST /billing/charge mutations must never be retried once bytes have left the TCP socket. FourWay gives you per-job retry_safe control and native 429 Retry-After compliance.
See how FourWay differs from a naive cron runner on the wire.
Select an upstream failure mode below and toggle retry_safe to inspect the socket-level decision trace.
Replace fragile platform crons in 2 minutes.
Keep your existing HTTP route handlers. Point FourWay at your endpoint and verify the Bearer token or idempotency header.
Vercel Hobby limits cron to once per day and never respects Retry-After. Expose an App Router route and schedule it every 1 or 5 minutes with retry_safe: false:
// app/api/cron/reconcile/route.ts
import { NextResponse } from 'next/server';
export async function POST(req: Request) {
const auth = req.headers.get('authorization');
if (auth !== `Bearer ${process.env.FOURWAY_CRON_SECRET}`) {
return NextResponse.json({ error: 'unauthorized' }, { status: 401 });
}
// Safe: FourWay with retry_safe=false guarantees it will NOT re-POST if this times out after write
await runBillingReconciliation();
return NextResponse.json({ ok: true, ts: Date.now() });
}
Create a mutation-safe job via the FourWay Tenant REST API (POST /api/v1/cron/jobs) with an idempotency header and signed failure webhook:
curl -X POST https://fourway.io/api/v1/cron/jobs \
-H "Authorization: Bearer fw_live_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "stripe-invoice-capture",
"url": "https://api.example.com/v1/billing/capture",
"method": "POST",
"every_sec": 300,
"timeout_ms": 10000,
"retry_safe": false,
"headers": { "X-Job-Source": "fourway-safe-cron" }
}'
If your upstream dependency is overloaded, return 429 Too Many Requests with Retry-After. FourWay pauses the job for the exact window without counting it as a fatal crash:
<?php
// public/webhooks/sync-inventory.php
if ($upstreamRateLimited) {
http_response_code(429);
header('Retry-After: 45'); // FourWay yields this job for 45s + jitter
echo json_encode(['status' => 'yielded', 'retry_after' => 45]);
exit;
}
http_response_code(200);
echo json_encode(['status' => 'ok']);