Linode (Akamai) Object Storage
linodeakamais3object-storagecorssigv4presigned-urls
Linode Object Storage is S3-compatible bucket storage. Justin's account uses it for tldr uploads (private bucket tldr-uploads, Chicago) and for videos.jhampton.io (private bucket in Newark). The S3 API works with hand-rolled SigV4 signing (no AWS SDK); the reusable client is ~/dev/tldr/api/s3_client.php. The big trap is that the two generations of Linode endpoints support different features.
Endpoint generations: CORS is the dividing line
- Newer, envoy-fronted endpoints (e.g. Chicago,
us-ord-10.linodeobjects.com, SigV4 region stringus-ord-1; responses carry aserver: envoyheader) answer 501 toPutBucketCorsand 405 to POST Object, and serve no CORS headers. A browser therefore cannot upload to or play cross-origin media from such a bucket directly; everything has to be relayed or streamed through your own server. - Legacy clusters (
us-east-1.linodeobjects.comin Newark and friends, noserver: envoyheader) do support bucket CORS. Verified with a real browser pre-signed PUT. - Choose the region by whether the browser must talk to the bucket. videos.jhampton.io moved its bucket to Newark for exactly this reason: the browser uploads to and plays from the bucket directly, and the 1 GB server only signs requests and holds metadata. tldr stays in Chicago and streams images through the API (which carries CORS) instead of redirecting to pre-signed URLs, which also keeps Flutter web's CanvasKit renderer happy.
Keys are per bucket
Access keys are limited keys scoped to specific buckets. Creating a new bucket while using an existing key grants that key no access to it; make or update a key for the new bucket. The failure is confusing: with the bucket-scoped tldr key, the CreateBucket call itself returned 200, but every object PUT into the new bucket got 403, which cost an hour on the music app's cloud locker (July 2026). The workaround used there was a prefix (locker/) inside the existing tldr-uploads bucket, with a JSON catalog object (locker/catalog.json) as the index. Key files are kept on the desktop as ~/linode-<name>-object-storage-key.txt; server-side config files (e.g. s3_conf.php, videos_conf.php) hold them, gitignored and mode 640.
Browser-direct uploads (legacy endpoint)
- Upload large files as multipart: 16 MB slices, three in flight, each part PUT to a pre-signed URL the server hands out.
- Some networks block the storage host while the site itself loads, and then every part fails instantly. For uploads by other people, fall back to relaying parts through your own server and log the reason (Upload links for people without an account (getting a full-quality video from a friend)).
- Grab poster frames client-side from a
<video>into a canvas, so no ffmpeg runs on the server.
API details worth knowing
- CopyObject is server-side, so renaming a file costs no bandwidth. It can answer HTTP 200 and still fail inside the XML body: check the body for
<CopyObjectResult. curl -Iagainst a GET-presigned URL returns 403 because SigV4 signs the HTTP method; HEAD is a different request. Fetch with GET.- ffmpeg/ffprobe segfault when given a pre-signed URL that returns an error body. Download to a file with curl first.
- Records should carry their own storage
keyrather than deriving paths from mutable names (series slugs, titles), so renames never require moving objects.
Reusing the client in another app (Hunsley Hills Salon)
The hhs site reused tldr's SigV4 client verbatim (api/s3_client.php, with putObject,
deleteObject, presignedGetUrl) against its own private Chicago bucket hhs-uploads, with
credentials in a server-only api/s3_conf.php (gitignored, .example committed, excluded from
the deploy's --delete). The API exposes POST /admin/uploads (multipart, type and size
checked, random filename, a media table row for the picker) and a public
GET /uploads/{filename} that streams bytes from the bucket with an immutable cache header.
Storing the full public URL (https://api.<site>/uploads/<name>) in content keeps pages
independent of the bucket. Images survive redeploys and server moves because they never live on
the server. Uploads are resized on the way in, see Resizing uploaded photos on the server (PHP GD).
One-off bucket surgery without exposing keys
To overwrite or add objects outside the API (e.g. recompressing existing images): process the
files locally, scp them plus a tiny PHP script to the server, and have the script
require the server's s3_conf.php and s3_client.php and call putObject($name, $bytes,
$mime). The credentials never leave the server.
Overwriting the same key keeps every stored URL valid, but anything already served with
Cache-Control: immutable stays cached in returning browsers; only new or expired visitors get
the new bytes. If a change must reach cached browsers, upload under a new key and update the
reference.
Testing tip
When curling a URL taken from a JSON response, unescape \/ first
(sed 's#\\/#/#g'); otherwise curl fails with "Port number was not a decimal" (status 000) and
the route looks broken when it is not.
Backups
A nightly rclone mirror copies the buckets to the desktop (~/backups/object-storage, cron 3:45 am); see Backing up Linode Object Storage buckets with rclone.
See also
- Open Graph link previews (SPAs, private posts, private-storage media)
- videos.jhampton.io (private video site architecture)
- TLDR platform architecture (tldrnerd.com)
Linked from
- A lightweight CMS for a small business site
- Accepting and serving user uploads safely from a private bucket
- Backing up Linode Object Storage buckets with rclone
- Exporting Google Photos with Takeout and restoring metadata with ExifTool
- Flutter web (renderers, SEO, performance, when not to use it)
- jhampton.io: one home domain, an index, and a wildcard certificate
- Nightly MySQL/MariaDB backups with mysqldump and cron
- Open Graph link previews (SPAs, private posts, private-storage media)
- PHP's uppercase-S TLS downgrade (CVE-2026-128064) and proving it on the wire
- Resizing uploaded photos on the server (PHP GD)
- Streaming public-domain music from the Internet Archive
- Upload links for people without an account (getting a full-quality video from a friend)
- videos.jhampton.io (private video site architecture)