-
Notifications
You must be signed in to change notification settings - Fork 32
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
CDN support #534
Comments
Is the intention that this will also work with Astro generated |
Good point. Since |
Probably okay to leave as-is given the good convo already kicked off, but for future proposals: we discussed reducing the effort on Stage 1/2 and moving away from including a specific solution in the OP to just including background/goals/non-goals. Solution ideas and discussion can go in a comment below (optional) at anytime, or just the RFC. Two examples: |
This is released, thank you @bluwy ! |
Body
Summary
Provide an option to specify a CDN URL for static assets to serve from in production.
Background & Motivation
Large traffic sites often have CDN servers that are optimized to serve assets only. For example, a site served from
https://astro.build
would reference all it's assets fromhttps://cdn.astro.build
.A CDN URL would also allow assets from multiple sites to be deployed to the same CDN server to share the performance, where they can be separated by URL subpaths.
There are also prior art from other frameworks that users want in Astro too:
Goals
import.meta.env.*
) to prepend links manually.astro:assets
images, and@astrojs/image
.Non-Goals
<link href>
or<img src>
etc.public
directory.Example
Astro config:
Generated HTML example:
Details and behaviours:
build.assets
option of_astro
directory, the user will copy all the files from thedist/_astro
directory to thehttps://cdn.example.com
server.base
option, becausebase
is the serving base of the user-facing site URL, e.g.https://example.com/foo/
. (similar to prior art)https://cdn.example.com/project-a
, and Astro would include it in the built URL.More prior art research
assetPrefix
.next/static/
ashttps://cdn.com/_next/static/
app.cdnURL
.output/public/_nuxt/
ashttps://cdn.com/_nuxt/
path.assets
.svelte-kit/output/client/_app/
ashttps://cdn.com/_app/
*Upload path may depend on deployment target / adapter
The text was updated successfully, but these errors were encountered: