Skip to main content
XenForo serves avatars, attachment thumbnails, and JavaScript from URLs set in src/config.php. Point those URLs at a Gcore CDN custom domain so browsers request the files from CDN instead of the origin. A CDN resource must exist first, with its origin pointing to the XenForo installation — otherwise requests for /data and /js paths return 404 responses. The custom domain must have a CNAME record pointing to the *.gcdn.co value shown in the CDN resource’s Setup guide.
Back up src/config.php and the database before editing. Incorrect URL values can break avatars and JavaScript.

CDN values before XenForo

Collect the custom domain and confirm DNS and HTTPS before editing src/config.php. The hostname looks like cdn.example.com.
1

Open the CDN resource

In the Gcore Customer Portal, navigate to CDN > CDN resources and open the resource.
2

Copy the custom domain

Note the custom domain shown for the resource, because that hostname is used in externalDataUrl and javaScriptUrl.
3

Confirm the DNS CNAME

Confirm that the custom domain has a CNAME record pointing to the *.gcdn.co value shown in the CDN resource’s Setup guide. Do not put the *.gcdn.co hostname directly in the XenForo URLs.
4

Confirm SSL

Confirm the custom domain has a valid SSL certificate so assets can load over HTTPS. Attach a certificate in SSL certificates.

XenForo URL configuration

externalDataUrl is the public URL for the data directory (avatars and attachment thumbnails), and javaScriptUrl is the public URL for the js directory.
1

Open the configuration file

Open src/config.php in the XenForo installation.
2

Set the CDN URLs

Add or update the following keys, using the custom domain and no trailing slash after the directory name. If XenForo is installed in a subdirectory, include that path in both URLs:
3

Save the configuration

Save src/config.php.
4

Confirm CDN delivery

Open the site, then open browser developer tools and select the Network tab. Refresh. Avatar, thumbnail, and JavaScript requests should use the custom domain and return HTTP 200. After cache fills, later requests can show Cache: HIT.

Optional style image URLs

Logo and other style images use a separate XenForo setting. Apply these changes to each style whose assets should load from CDN — XenForo style properties can be inherited or customized per style, so a child style that has not customized a property inherits it from the parent.
1

Open Style properties

In the XenForo admin control panel, navigate to Appearance > Styles, then click Style properties for the style you want to update.
2

Open Basic options

Select the Basic options group.
3

Update the image URL fields

Set Path to images and any other image URL fields that reference origin assets to use the custom CDN domain. For example, change https://example.com/styles/default/xenforo to https://cdn.example.com/styles/default/xenforo.
4

Save

Click Save. Repeat for each additional style that serves assets from CDN.