DeploxaDeploxa/Docs
Back to site
  • Edge Storage
  • Cron Jobs
  • Firewall & WAF
  • Observability
  • Analytics & Speed
  • Redirects & Headers
  • Rate Limiting & Protection

Cron Jobs

Cron Jobs

Schedule recurring HTTP calls into your own app. Deploxa fires a request to a path you choose on your deployment, on the cron schedule you set — useful for cleanups, digests, cache warming, or syncing external data.

How it works

You register a job with a schedule and a path. Every minute a scheduler checks which jobs are due, and for each due job Deploxa sends an authenticated GET request to https://your-project.deploxa.com/your/path. Your app does the work and returns a 2xx; anything else is recorded as a failed run.

In the dashboardProject → Cron Jobs
Cron jobs call your deployed app — the logic runs in your code, not on Deploxa. Deploxa only handles the scheduling, authentication, and run history.

Define a job

Create a job in the dashboard with two fields:

FieldExampleMeaning
Schedule0 * * * *Standard 5-field cron expression (UTC)
Path/api/cron/cleanupPath on your deployment that receives the request

A few common schedules: * * * * * every minute, */15 * * * * every 15 minutes, 0 0 * * * daily at midnight, 0 9 * * 1 9am every Monday.

The CRON_SECRET

So your endpoint can tell a real cron call from a random internet request, Deploxa signs each call with a per-project secret. Set an environment variable named CRON_SECRET on your project, and Deploxa sends its value as a Bearer token (plus an x-deploxa-cron: 1 header) on every cron request.

In the dashboardProject → Settings → Environment Variables
http
GET /api/cron/cleanup
Authorization: Bearer <your CRON_SECRET>
x-deploxa-cron: 1
Always verify the Bearer token in your handler. Without the check, anyone who knows the path could trigger your job.

Example handler

Next.js (App Router)

typescript
// app/api/cron/cleanup/route.ts
export async function GET(req: Request) {
  const auth = req.headers.get("authorization");
  if (auth !== `Bearer ${process.env.CRON_SECRET}`) {
    return new Response("Unauthorized", { status: 401 });
  }

  await deleteExpiredSessions();
  return Response.json({ ok: true });
}

Express

javascript
app.get("/api/cron/cleanup", (req, res) => {
  if (req.headers.authorization !== `Bearer ${process.env.CRON_SECRET}`) {
    return res.status(401).send("Unauthorized");
  }
  runCleanup();
  res.json({ ok: true });
});

Run now & history

Use Run now on the Cron Jobs page to trigger a job immediately without waiting for its schedule — handy for testing. Every run (scheduled or manual) is logged with its status and duration; the last 100 runs per job are kept.

Edge StorageFirewall & WAF