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

NextJS: static assets should use the CDN #2518

Closed
3 tasks done
eatyourgreens opened this issue Nov 5, 2021 · 2 comments · Fixed by #2541
Closed
3 tasks done

NextJS: static assets should use the CDN #2518

eatyourgreens opened this issue Nov 5, 2021 · 2 comments · Fixed by #2541
Labels
enhancement New feature or request

Comments

@eatyourgreens
Copy link
Contributor

eatyourgreens commented Nov 5, 2021

Package

app-project
app-content-pages

Is your feature request related to a problem? Please describe.

Static assets are being served direct from fe-project.zooniverse.org. See the list here:

https://www.webpagetest.org/result/211012_AiDc90_8b632dd922250dee0f45d20c722a5bd5/1/performance_optimization/

Screenshot of a performance test, listing files that are being served direct from the origin.

Describe the solution you'd like

Set up prefixes, in the Next config, for the NextJS apps, then use those prefixes to serve _next for each app via www.zooniverse.org/projects/_next and www.zooniverse.org/about/_next.

There's a couple of static images for projects, which should also be proxied:
https://github.com/zooniverse/front-end-monorepo/tree/master/packages/app-project/public

Static proxying will need to be set up for staging and production, and the asset prefixes for the apps will need to be updated.

Context

NextJS 9.5 added basePath, to allow for multiple apps running on a single domain. We can use that to set up both Next apps on www.zooniverse.org, which then allows Next's static assets to be served with CDN caching.

I think the order of operations here would be:

  1. Add basePath to each app's config, and verify that it works.
  2. Add rules for _next/ and public/ to our static setup. Add rules for production and staging NextJS apps static#253
  3. Update the asset prefixes, in this repo, from fe-project and fe-content-pages subdomains to www.zooniverse.org (production) and frontend.preview.zooniverse.org (staging.) Use CDN domains for asset prefixes #2541
@eatyourgreens
Copy link
Contributor Author

Reopened by #4225.

@goplayoutside3
Copy link
Contributor

Closed by #4292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants