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

feat: add CDN #2871

Merged
merged 14 commits into from
Oct 23, 2024
Merged

feat: add CDN #2871

merged 14 commits into from
Oct 23, 2024

Conversation

andipaetzold
Copy link
Contributor

@andipaetzold andipaetzold commented Sep 12, 2024

Creating a CDN for Forma using Fastly Compute to host the Geist font: https://vercel.com/font.

Adds a GH action that auto-deploys the CDN when merging to main.

The files will be deployed as https://cdn.f36.contentful.com/*. You can try an example deploy with an older font version: https://cdn.f36.contentful.com/fonts/geist-sans-1.3.0.woff2

Copy link

vercel bot commented Sep 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
forma-36 ✅ Ready (Inspect) Visit Preview Oct 23, 2024 11:13am

Copy link

changeset-bot bot commented Sep 12, 2024

⚠️ No Changeset found

Latest commit: 426619a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

github-actions bot commented Sep 12, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
CommonJS 112.03 KB (0%) 2.3 s (0%) 1.8 s (+19.72% 🔺) 4 s
Module 110.84 KB (0%) 2.3 s (0%) 1.9 s (-7.73% 🔽) 4.1 s

Copy link

Marking pull request as stale since there was no activity for 30 days

@github-actions github-actions bot added the stale Used to mark when there was no activity for a set period of time label Oct 13, 2024
@lewiscowper lewiscowper removed the stale Used to mark when there was no activity for a set period of time label Oct 21, 2024
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci --workspace=@contentful/f36-cdn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today I learned.

@denkristoffer
Copy link
Collaborator

Just a general question but shouldn't a CDN generally be served from a different domain to avoid wasting bytes on cookies from the web app?

@andipaetzold
Copy link
Contributor Author

Just a general question but shouldn't a CDN generally be served from a different domain to avoid wasting bytes on cookies from the web app?

Yes, to save every single byte, we would need to use a totally separate domain. For the Web App itself, the HTML is loaded from app.contentful.com and the static files from static.contentful.com to reduce the number of cookies. Not all cookies have strict same site policy, so they are also sent to static.contentful.com.

Fonts are only loaded once per page load (+within apps) and are not render blocking. Having a separate domain would have an insignificant performance improvement. By using a contentful.com subdomain, customers inspecting the network traffic know that the traffic goes to Contentful and not a third party service.

@andipaetzold andipaetzold merged commit 6957f9e into main Oct 23, 2024
11 of 12 checks passed
@andipaetzold andipaetzold deleted the CFISO-1735-cdn branch October 23, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants