Integrate a CDN resource with Perch
Perch can deliver uploaded resources through a Orange's CDN resource by adding the CDN domain to its resource paths.
Back up site files and the database before making changes. These steps assume a standard local perch/resources directory without a custom or remote resource-storage handler.
Create a CDN resource before starting the integration. Configure its custom domain with a valid CNAME record and an active SSL certificate.
-
In the CDB Customer Portal, find the custom domain on the CDN resources page.
-
Confirm that the CDN origin can retrieve a known file from the default resource directory. Perch requires this directory to be directly accessible through a URL, as described in the resource documentation.
Use the origin protocol and hostname configured for the CDN resource:
https://origin.example.com/perch/resources/example.jpgContinue only after the origin URL returns the expected file.
-
Open
perch/config/config.phpon the server and find:define('PERCH_RESPATH', PERCH_LOGINPATH . '/resources'); -
Replace it with the custom domain as the host prefix:
define('PERCH_RESPATH', 'https://cdn.site.com' . PERCH_LOGINPATH . '/resources'); -
Optional — Perch resource buckets can use local directories, remote storage, private download scripts, or custom handlers. In
perch/config/buckets.php, update only local file buckets that the same CDN origin can access, and leave remote or access-controlled buckets unchanged.Prefix the eligible bucket's
web_pathwith the custom domain while keeping its original path:// Before 'web_path' => '/my/bucket/path', // After 'web_path' => 'https://cdn.site.com/my/bucket/path', -
Save the configuration files.
-
Confirm the integration by opening the browser's developer tools (press F12), selecting the Network tab, and refreshing the page — eligible resource URLs should now load from the custom domain instead of the origin domain.