Overview
ButterCMS media assets are served through a global CDN with built-in security features. This guide covers how image URLs work, access control, and best practices for protecting your media.URL security model
Random CDN slugs
Each media file in ButterCMS is assigned a unique, random slug that serves as its identifier:- Slugs are randomly generated by Filestack during upload
- They are not sequential or predictable
- Knowledge of one URL does not reveal others
Public CDN access
By default, all media on the ButterCMS CDN is publicly accessible:- No authentication required to access images
- Images can be embedded anywhere (websites, emails, apps)
- Search engines can index images if linked publicly
This model follows the same security pattern as other headless CMS platforms—media URLs are designed to be publicly embeddable.
Access control strategies
Keep URLs private
If you need to control who sees your images:- Server-side rendering: Fetch images server-side and serve through your authenticated endpoints
- Proxy through your app: Create authenticated routes that proxy CDN requests
- Short-lived URLs: Generate URLs only when needed, don’t store them long-term
Proxy implementation
Signed URLs pattern
Signed URLs are not a built-in ButterCMS feature. The following is an example pattern you can implement in your own backend to control access through a proxy.
HTTPS enforcement
All ButterCMS CDN URLs use HTTPS:- Encrypted data transmission
- Protection against man-in-the-middle attacks
- Required for modern security headers (HSTS, CSP)
Content security policy
Configure your CSP headers to allow ButterCMS images:With inline styles (for background images)
Next.js configuration
Transformation security
Image transformations don’t require additional authentication:- Anyone with the file ID can apply any transformation
- Transformations are cached at the CDN edge
- No additional cost for transformations
Rate limiting transformations
If you’re concerned about transformation abuse:- Proxy transformations: Route through your server with rate limiting
- Cache aggressively: Use CDN caching for transformed images
- Monitor usage: Track transformation requests in your analytics
Hotlink protection
To prevent other sites from embedding your images:Server-side referrer checking
Nginx configuration
Best practices
Don't Expose File IDs
Avoid exposing CDN file IDs in client-side code for sensitive content.
Use HTTPS Always
Ensure all image references use HTTPS URLs.
Implement CSP
Configure Content Security Policy headers for your domain.
Monitor Access
Track image access patterns for unusual activity.
API token security
Your ButterCMS API tokens (Read/Write) are separate from image access:| Token Type | Image Access | Use Case |
|---|---|---|
| Read Token | Not required for CDN images | Fetching content metadata |
| Write Token | Not required for CDN images | Creating/updating content |
Sensitive content guidelines
For truly sensitive media:- Don’t upload to ButterCMS: Use a dedicated secure storage solution
- Encrypt before upload: Encrypt files client-side if you must store them
- Access control: Implement server-side access control with signed URLs
- Audit logging: Track all access to sensitive media
Next steps
Image Transformations
Transform images via URL
Responsive Images
Optimize for devices
Authentication
API authentication
Media Library
Managing media