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

# Integrate a CDN resource with PrestaShop

PrestaShop can rewrite static asset URLs to an external media server. Configure a Gcore CDN resource as that media server to cache and deliver store images, theme files, and module assets.

<Info>
  These instructions apply to PrestaShop 9. Back up the store files and database before changing performance settings.
</Info>

<Steps>
  <Step title="Prepare the CDN resource">
    In the Gcore Customer Portal, create a [CDN resource](/cdn/getting-started/create-a-cdn-resource/create-a-cdn-resource) with the PrestaShop store as its origin.

    Add a [custom domain](/cdn/cdn-resource-options/general/create-and-set-a-custom-domain-for-the-content-delivery-via-cdn) — `cdn.example.com` — and enable HTTPS. Confirm that the CDN domain can retrieve files from the `/img`, `/themes`, and `/modules` directories.
  </Step>

  <Step title="Open the Performance page">
    Sign in to the PrestaShop Back Office and navigate to **Advanced Parameters** > **Performance**.
  </Step>

  <Step title="Set the media server">
    In the **Media servers** section, enter the custom CDN hostname in **Media server #1** — `cdn.example.com`.

    Enter only the hostname. Do not include `https://`, a path, or a trailing slash. PrestaShop 9 supports one media server by default.
  </Step>

  <Step title="Save and clear the cache">
    Select **Save**, and then select **Clear cache** at the top of the **Performance** page.
  </Step>

  <Step title="Verify CDN delivery">
    Open the storefront in a private browser window. Open the browser developer tools, select **Network**, and reload the page.

    Filter requests by `cdn.example.com`. Confirm that static files use the CDN hostname and return successful HTTP responses.
  </Step>
</Steps>

Combine, Compress and Cache (CCC) on the **Performance** page is a separate PrestaShop feature and is not required to activate the CDN. Enabling **Smart cache for JavaScript** can cause errors in themes or modules that rely on a specific loading order.

## Troubleshooting

When static files fail to load from the CDN hostname, the cause is usually a missing origin path, an origin connectivity error, a TLS or mixed-content block, a cache that still serves the previous URL, or a theme that does not use the media-server rewrite.

* For a `404` response, confirm that the origin contains the requested path and that the CDN can retrieve the `/img`, `/themes`, and `/modules` directories.
* For a `502` response, check the origin hostname, origin pull protocol, port, and host header in the CDN resource.
* If the browser blocks requests, confirm that the custom CDN domain has a valid TLS certificate and the storefront uses HTTPS URLs.
* If old assets remain visible, clear the PrestaShop cache and [purge CDN cache](/cdn/clear-cdn-resource-cache-by-url-pattern-or-all).
* If only some URLs use the CDN, check theme and module compatibility with the PrestaShop media-server feature. Custom absolute URLs are not rewritten.
