Generic Origin Mode
CMS Assets has built-in support for Prismic, Contentful, Sanity, Shopify, Cloudinary, and Imgix, but you can also proxy any HTTPS asset origin by providing a custom origin URL in your tenant configuration.
Use cases
- AWS S3 — Proxy assets from S3 buckets without exposing bucket URLs
- Cloudflare R2 — Add caching and bandwidth tracking on top of R2
- Google Cloud Storage — Route GCS-hosted media through CMS Assets
- Legacy CMS servers — Proxy assets from self-hosted CMS installations
- Any HTTPS origin — If it serves files over HTTPS, CMS Assets can proxy it
Tenant configuration
Select Generic Origin as the CMS type when creating or editing a tenant in the admin dashboard. Enter the full HTTPS origin URL in the Origin URL field. If your videos are hosted on a separate origin, fill in the optional Video Origin URL field.
You can also create generic origin tenants via the API by sending the origin URL as the originUrl field:
Example: S3 bucket
{
"slug": "my-project",
"cms": "generic",
"originUrl": "https://my-bucket.s3.amazonaws.com",
"websiteDomain": "my-site.com",
"cacheTTL": 86400
}
With this configuration, a request to:
https://my-project.cmsassets.com/images/photo.jpg
Is proxied to:
https://my-bucket.s3.amazonaws.com/images/photo.jpg
Example: Cloudflare R2
{
"slug": "my-r2",
"cms": "generic",
"originUrl": "https://pub-abc123.r2.dev",
"cacheTTL": 604800
}
Example: Google Cloud Storage
{
"slug": "my-gcs",
"cms": "generic",
"originUrl": "https://storage.googleapis.com/my-bucket",
"cacheTTL": 172800
}
Separate video origin
If your videos are served from a different origin than images, you can configure a videoOrigin. In the admin dashboard, this field appears when Generic Origin is selected as the CMS type.
Via the API:
{
"slug": "my-project",
"cms": "generic",
"originUrl": "https://images.my-cdn.com",
"videoOrigin": "https://videos.my-cdn.com",
"cacheTTL": 86400
}
Video file types (mp4, webm, mov, m4v) will be fetched from videoOrigin, while all other asset types use the primary origin.
Configurable options
Each tenant supports these configuration options:
| Option | Type | Default | Description |
|---|---|---|---|
origin | string | — | Primary HTTPS origin URL (required) |
videoOrigin | string | — | Separate origin for video files |
cacheTTL | number | 172800 (2 days) | Edge cache duration in seconds (60 – 2,592,000) |
allowedTypes | string[] | — (all types allowed) | Content-Types to allow. If not set, all types are served |
stripQueryParamsFor | string[] | — (query params included in cache key) | File extensions where query params are stripped from cache key |
blockedBotsRegex | string | (default pattern) | Custom regex for blocking bots by User-Agent |
websiteDomain | string | — | Your frontend domain, sent as Referer to origin |
Response transformer with generic origins
Since v0.4.0, the response transformer has built-in support for generic origins via cms: "generic". Pass your origin URL as originUrl and all matching asset URLs in the response payload will be rewritten automatically:
import { transformCmsAssetUrls } from "@synchronized-studio/response-transformer"
const transformed = transformCmsAssetUrls(data, {
cms: "generic",
originUrl: "https://my-bucket.s3.amazonaws.com",
cmsAssetsUrl: "https://my-project.cmsassets.com"
})
You can also use the dedicated transformGenericAssetUrls function directly:
import { transformGenericAssetUrls } from "@synchronized-studio/response-transformer"
const transformed = transformGenericAssetUrls(data, {
originUrl: "https://my-bucket.s3.amazonaws.com",
cmsAssetsUrl: "https://my-project.cmsassets.com"
})
Both approaches will rewrite URLs like https://my-bucket.s3.amazonaws.com/images/photo.jpg to https://my-project.cmsassets.com/images/photo.jpg, preserving the path and query parameters.
Notes
- The origin must be HTTPS. HTTP origins are rejected.
- The path structure is preserved 1:1 — the request path is appended directly to the origin URL.