Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple cdn #6982

Closed
wants to merge 9 commits into from
27 changes: 26 additions & 1 deletion src/content/docs/en/reference/configuration-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ Specifies the directory in the build output where Astro-generated assets (bundle

<p>

**Type:** `string`<br />
**Type:** `string | Record.<string, string>`<br />
**Default:** `undefined`<br />
<Since v="2.2.0" />
sarah11918 marked this conversation as resolved.
Show resolved Hide resolved
</p>
Expand All @@ -512,6 +512,31 @@ To rename the `_astro` path, specify a new directory in `build.assets`.
}
```

#### defaultAssetsPrefix

<p>

**Type:** `string`<br />
**Default:** `''`<br />
<Since v="4.5.0" />
</p>

If your static files are served from different CDNs, you can configure `build.assetsPrefix` to use unique prefix paths for each CDN based on the file extension requested. `defaultAssetsPrefix` is used to fetch all other file extensions not defined.

The following example shows `.js` files served from `https://js.cdn.example.com` and `.css` files served from `https://css.cdn.example.com`. All other assets will be served from `https://cdn.example.com`.

```js
{
build: {
assetsPrefix: {
'js': 'https://js.cdn.example.com',
'css': 'https://css.cdn.example.com',
'defaultAssetsPrefix': 'https://cdn.example.com'
}
}
}
```

### build.serverEntry

<p>
Expand Down
Loading