> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gcore.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate CDN resource with XenForo

> Configure XenForo externalDataUrl and javaScriptUrl to serve avatars, thumbnails, and JavaScript from a Gcore CDN custom domain.

[XenForo](https://xenforo.com) 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](/cdn/getting-started/create-a-cdn-resource/create-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](/cdn/cdn-resource-options/general/create-and-set-a-custom-domain-for-the-content-delivery-via-cdn) must have a CNAME record pointing to the `*.gcdn.co` value shown in the CDN resource's Setup guide.

> [!WARNING]
>
> 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](https://portal.gcore.com), 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](/cdn/ssl-certificates/configure-your-own-ssl-certificate).

## 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:

```php theme={null}
$config['externalDataUrl'] = 'https://cdn.example.com/data';
$config['javaScriptUrl'] = 'https://cdn.example.com/js';
```

**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](https://docs.xenforo.com/manual/appearance/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.
