fargone / docs / cdn

The CDN lets you upload files and serve them from public URLs. Each file gets a permanent, immutable URL under your app's namespace.

Quick start

fargone cdn upload ./logo.png

The file is stored and returns a public URL you can link from anywhere.

CLI

fargone cdn                         # list uploaded files + storage used
fargone cdn upload <file>           # upload a file
fargone cdn rm <id>                 # delete a file by ID
fargone cdn env <slug>              # print CDN env vars for local dev
fargone cdn rotate <slug>           # rotate the app's CDN token

Web

Go to Settings > CDN to upload, browse, and delete files. Copy URLs with one click.

Uploading from your app

Each app gets CDN credentials injected as environment variables. Use them to upload from your code:

POST {FARGONE_CDN_URL}
Authorization: Bearer {FARGONE_CDN_TOKEN}
Content-Type: multipart/form-data

path=assets/logo.png
file=<bytes>

Example (Node.js)

const form = new FormData();
form.append("path", "images/photo.jpg");
form.append("file", buffer, { filename: "photo.jpg" });

await fetch(process.env.FARGONE_CDN_URL, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.FARGONE_CDN_TOKEN}` },
  body: form,
});

Serving files

Files are served at:

{FARGONE_CDN_PUBLIC_URL}/{path}

For example: https://myapp.platform.fargone.sh/cdn/myapp/assets/logo.png

Features

  • Range requests (HTTP 206 Partial Content) for large files
  • ETag / If-None-Match (304 Not Modified)
  • Immutable caching — Cache-Control: public, max-age=31536000, immutable
  • Streaming — large files are streamed, not loaded into memory

CDN environment variables

Variable Description
FARGONE_CDN_URL Upload endpoint
FARGONE_CDN_PUBLIC_URL Public serving base URL
FARGONE_CDN_TOKEN Auth token for uploads
FARGONE_CDN_PREFIX Namespace prefix (your app slug)

Use fargone cdn env <slug> to print these for local development.

Token rotation

If a token is compromised, rotate it:

fargone cdn rotate my-app

This immediately invalidates the old token. Redeploy your app to pick up the new one:

fargone apps deploy my-app

Storage limits

CDN storage is bounded by your quota (default: 100 MiB). Check your usage with fargone cdn. If you need more, request a quota increase:

fargone quota request cdn 524288000 "need 500MiB for static assets"