Skip to main content

Public file addresses and upload limits

Two settings groups here. The first decides what address a visitor's browser uses to fetch the gallery, posters and other public files. The second sets how large each kind of upload may be. This page is for whoever runs the server; the defaults suit most choirs.

Where public files are fetched from​

PUBLIC_FILES_URL is empty by default. A trailing slash is removed.

PUBLIC_FILES_URLWhat happens
Not setThe site serves public files itself, at /files/<key>, with a cache lifetime of a year (they never change: every upload has a new key). It works with every storage provider and needs no bucket policy. Fine for most choirs.
Set, for example https://files.example.orgPages link to that address followed by the key, for example https://files.example.org/gallery/1767225600000-3f9a….jpg. The address must serve the public bucket's contents at the root: a CDN in front of it, an R2 custom domain, a public-read bucket, or MinIO behind your proxy. This takes the file traffic off the site.

Things to know:

  • It applies to the public store only. Member files and rehearsal tracks are always streamed by the site, after a login check, whatever this is set to.
  • Gallery items, Past Events posters and the like store only a key, so changing PUBLIC_FILES_URL changes their addresses straight away. A concert poster, the logo and a picture uploaded into Site Settings store the address that was in force when you uploaded them, so they keep their old address. See How files are stored.
  • The site does not check that your address works. If it serves nothing, pictures are broken until you unset the setting or fix the address.
  • The /files/ route still answers when this is set, so addresses stored before you set it keep working.

On Cloudflare, put it under [vars] in wrangler.toml; Cloudflare: your domain and public files walks through an R2 custom domain.

Upload limits​

Four settings, each a whole number of megabytes. A value that is not a number is ignored and the default is used.

VariableDefaultWhat it limits
UPLOAD_MAX_IMAGE_MB10A concert poster, the logo and any picture uploaded into a setting, and a poster uploaded on the Past Events page.
UPLOAD_MAX_GALLERY_MB100One photo or video uploaded to the gallery.
UPLOAD_MAX_FILE_MB50One document shared with members.
UPLOAD_MAX_TRACK_MB50One rehearsal track (MP3 or M4A).

A file over the limit is refused with File too large. Maximum size is 10MB., with the number of your limit. Each file is checked on its own; there is no limit on how many files you upload.

Other limits that also apply​

The site's limit is not the only one. A smaller one anywhere on the way wins.

  • Your reverse proxy. nginx refuses request bodies over 1 MB by default (client_max_body_size); Caddy has no default limit. If gallery uploads fail with a 413 error that is not the site's message, raise the proxy's limit to at least your largest setting. See Put it behind HTTPS.
  • Cloudflare Workers. A request body can be at most 100 MB. Keep UPLOAD_MAX_GALLERY_MB to about 90 or less there.
  • Uploads are held in memory. The server reads a whole upload before storing it, so a very high limit costs memory for each upload in progress.

The page for uploading rehearsal tracks always says "MP3 or M4A, up to 50MB each", whatever UPLOAD_MAX_TRACK_MB is. If you change that limit, tell your admins the real figure. WAV tracks are refused whatever the limit: they must be converted first.

If something goes wrong​

What you seeCause
File too large. Maximum size is 10MB.The file is over the limit in the table above. Make it smaller, or raise the setting and restart.
An upload fails without that messageA limit in front of the site, such as the proxy's.
Pictures are broken after setting PUBLIC_FILES_URLThe address does not serve the public bucket at its root. Check one address by hand: your address followed by a key from the bucket.