V2 of our Asset Platform does not support custom domains. If your project is using our Asset Platform V2 you can upgrade to V3 by following the instructions here.
You can add a custom domain or subdomain to the Servd Asset Platform to be used to serve files and image transforms.
β
We handle raw files and image transforms separately, so each requires its own domain or subdomain, but the setup process is the same for both.
Visit the Assets page for your project in the Servd dashboard.
In the 'Asset Domains' panel, add a custom domain for transforms, files or both.
βYour domains should not have a protocol or path included.
Valid: images.mysite.com
Invalid: https://images.mysite.com/path
Then click 'Save'.
If you receive an error message stating that the domain is already associated with the platform, the domain has been used by another project already and will need to be removed from the other project before it can be added again.
Create DNS records for your asset subdomains. These should be created as CNAME records with a value matching the respective 'Default Domain' listed in the 'Asset Domains' panel.
E.G:
Type: CNAME
Name: images
Value: project-slug.transforms.svdcdn.com
If you're using a reverse proxy service to manage your DNS (e.g. Cloudflare) then you'll want turn off proxying for this record to activate the SSL in the next step.
Once the DNS records have been created and have had a few minutes to propagate, click the 'Activate SSL' buttons to create SSL certificates for them.
If you have problems with this step you might need to wait a few more minutes for DNS propagation to complete. You can also let us know and we'll check to make sure everything looks a-ok.
βWithin your project in local dev, visit the Settings > Filesystems page in the Craft Control Panel.
For each Servd filesystem, set the 'Custom CDN URL Pattern' to equal:
https://<your-custom-files-domain>/#{{environment}}/#{{subfolder}}/#{{filePath}}
And the 'Custom Image Optimise URL Pattern' to equal:
https://<your-custom-transforms-domain>/#{{environment}}/#{{subfolder}}/#{{filePath}}#{{params}}
If your filesystems are not using subfolders, you can remove that path segment in these values.
You can update every Servd Filesystem with the same values. If there are multiple filesystems, each should already have a 'Subfolder' set which is used to separate them.
Commit the changes to Craft's project config files and build a new bundle on Servd to roll out the change to all of your environments!