homeaboutvideotry it nowpricingdocs
Docs

Getting Started

Allowed origins

List the websites whose pages can upload with your public key, so other sites can't put your key in their pages.

What it does

Your public key is meant to be in your web pages, so anyone can copy it. Without allowed origins, any other website could put it in its own pages and upload to your app from its visitors' browsers, using your storage.

When you list your sites, every request made with the public key from a page on any other site is refused with

403 origin_not_allowed
. An empty list, the default, means any site, as it always has.

This is a browser-side control. Browsers always tell Fileboy which site a page is on, and a page can't change that, so it reliably stops other websites. It does not stop someone calling the API directly: a script, curl or a server can send any
Origin
header it likes. Anyone who has your public key can still upload that way. When uploads must be locked down, see when you need more.

Set it up

In the dashboard, open the app's Settings and find Allowed origins (the API keys page links to it). Add one site per line and save. Or set it from your server with the private key, through

PATCH /app/settings
or a library:

Allowed origins
// needs the private key. Pages on other sites can no longer upload with your public key.
await fileboy.setAllowedOrigins(["https://example.com", "https://*.example.com", "http://localhost:*"])
await fileboy.getAllowedOrigins()
// { allowedOrigins: ["https://example.com", ...], blockRequestsWithoutOrigin: false }
await fileboy.setAllowedOrigins([]) // any site again

The answer, and

GET /app/settings
, give the list as it was stored:

1
2
3
4
5
6
7
8
9
{
  "data": {
    "requireSignedReads": false,
    "stripLocationOnUpload": false,
    "playerBranding": {},
    "allowedOrigins": ["https://example.com", "https://*.example.com", "http://localhost:*"],
    "blockRequestsWithoutOrigin": false
  }
}

Send

[]
or
null
to allow any site again. Nothing changes unless every entry is valid: a bad one is a
400 validation_error
that names it and says what is wrong. An app can list up to 50 origins.

Add your local development server too (for example

http://localhost:*
) if you upload from it with the same app, or use a separate app for development.

How origins are matched

An origin is a scheme, a host and a port, with no path:

https://example.com
. Each entry is matched like this:

  • The scheme must match.
    https://example.com
    does not allow
    http://example.com
    . Only http and https are accepted. An entry without a scheme is stored with https://.
  • The host must match exactly, ignoring case. www is a different host: list
    https://www.example.com
    if your site uses it.
  • Wildcard subdomains.
    https://*.example.com
    matches any subdomain at any depth, but not
    example.com
    itself. The star can only be the first part of the host, and must cover at least two parts (
    *.com
    is refused).
    *.localhost
    is allowed.
  • Ports. No port means the scheme's default (443 for https, 80 for http), as browsers send it. Any other port must be listed, or use
    :*
    for any port, which suits local servers.
  • IP addresses work as hosts, like
    http://127.0.0.1:8080
    or
    http://[::1]:3000
    , but not with a wildcard.
  • International domain names are written in their
    xn--
    form, which is what browsers send.

Entries are stored normalised: lowercase, without a default port or a trailing slash, and without duplicates.

EntryAllowsDoes not allow
https://example.com
https://example.comhttps://www.example.com, http://example.com
https://*.example.com
https://app.example.com, https://pr-12.preview.example.comhttps://example.com (list it as well)
http://localhost:3000
http://localhost:3000http://localhost:5173
http://localhost:*
http://localhost:5173, http://localhosthttp://127.0.0.1:5173
https://example.com:8443
https://example.com:8443https://example.com
example.com
Stored as https://example.com

Fileboy reads the request's

Origin
header, or its
Referer
when there is no Origin (only the scheme, host and port of it count). The
null
origin, which browsers send from sandboxed frames, local files and some redirects, is never allowed once you have a list, because any site can produce it. Browser extension origins are not allowed either. With no list, nothing is checked, as before: pages on a local file or inside a hybrid mobile app, which often send null, keep working.

Which requests are checked

Every request that uses the public key:

  • POST /files/upload
    , from a file or a URL
  • POST /videos/upload
  • POST /videos/:id/poster/upload
    and
    POST /videos/:id/transcripts/upload

The check happens before the upload is read. These are never checked:

  • Requests signed with your private key, and access tokens your server made with it.
  • Reads. Files, images, label URLs and videos are served as before: a public file stays readable from any site, and signed URLs are how you restrict reads.
  • CORS preflights (
    OPTIONS
    ), which carry no key. They are answered the same for every site, and the upload that follows is checked.
  • The Fileboy dashboard, so you can always upload to your app by hand.

Requests with no Origin

Browsers send an

Origin
header with every upload. Servers, scripts, curl and most mobile apps send neither Origin nor Referer. By default those requests are allowed, so a server or app that uploads with the public key keeps working when you list your sites.

If nothing uploads with the public key from outside a browser, you can refuse them too: tick Also refuse requests that don't say where they came from in the dashboard, or send

blockRequestsWithoutOrigin: true
. It only applies while the list has sites in it, and clearing the list turns it off. It makes casual misuse of a copied key harder, but a script can still send a made-up header.

Errors

A refused request gets a

403
with the error code
origin_not_allowed
and a message that names the origin. Like every API response it has the CORS headers, so the page that was refused can read why, and it is never cached. The libraries throw an error with this message, and the React uploaders show it under the upload.

1
2
3
4
5
6
7
8
9
HTTP/1.1 403 Forbidden
Access-Control-Allow-Origin: *
Cache-Control: no-store
Content-Type: application/json

{
  "error": "origin_not_allowed",
  "message": "This app only accepts its public key from the websites in its allowed origins, and https://other-site.example is not one of them. Add it to the app's allowed origins in its settings, or send the request from your server, signed with your private key."
}

If your own site is refused, check the scheme, the www and the port in the message against your list.

When you need more

Allowed origins stop other websites, not other programs. To make sure only your users can upload, have your server decide:

  • Give the page a short-lived upload token from your server, made with the private key (
    createAccessToken({ upload: true })
    in the Node library), after checking the user is signed in. Requests with a token are signed, so they don't depend on headers. See Security + Permissions.
  • Or upload from your server with the private key.

Allowed origins still help alongside either: they keep your public key off other sites' pages.

Allowed origins

What it doesSet it upHow origins are matchedWhich requests are checkedRequests with no OriginErrorsWhen you need more
hello@fileboy.io

Fileboy

HomeAboutPricingChangelog
© Copyright 2026, CD2 Solutions Ltd.
Terms and ConditionsPrivacy Policy