From 2759719044de5bc3a005213de6d27698aec29056 Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Tue, 16 Nov 2021 11:55:20 +0000 Subject: [PATCH] Use CDN domains for asset prefixes (#2541) * Move asset prefixes to CDN domains * Move static assets to /assets * Add robots.txt Disallow all agents from fe-project.zooniverse.org and fe-content-pages.zooniverse.org. --- kubernetes/deployment-production.tmpl | 4 ++-- kubernetes/deployment-staging.tmpl | 4 ++-- packages/app-content-pages/public/robots.txt | 2 ++ .../public/{ => assets}/simple-avatar.png | Bin .../public/{ => assets}/subject-placeholder.png | Bin packages/app-project/public/robots.txt | 2 ++ .../components/RecentSubjects/RecentSubjects.js | 2 +- .../components/TeamMember/TeamMember.js | 2 +- .../components/SubjectSetCard/SubjectSetCard.js | 2 +- 9 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 packages/app-content-pages/public/robots.txt rename packages/app-project/public/{ => assets}/simple-avatar.png (100%) rename packages/app-project/public/{ => assets}/subject-placeholder.png (100%) create mode 100644 packages/app-project/public/robots.txt diff --git a/kubernetes/deployment-production.tmpl b/kubernetes/deployment-production.tmpl index e154d793c1..91fa9199ef 100644 --- a/kubernetes/deployment-production.tmpl +++ b/kubernetes/deployment-production.tmpl @@ -69,7 +69,7 @@ spec: - containerPort: 3000 env: - name: PROJECT_ASSET_PREFIX - value: https://fe-project.zooniverse.org/projects + value: https://www.zooniverse.org/projects - name: COMMIT_ID value: __IMAGE_TAG__ - name: NEWRELIC_LICENSE_KEY @@ -169,7 +169,7 @@ spec: - containerPort: 3000 env: - name: CONTENT_ASSET_PREFIX - value: https://fe-content-pages.zooniverse.org/about + value: https://www.zooniverse.org/about - name: COMMIT_ID value: __IMAGE_TAG__ - name: CONTENTFUL_ACCESS_TOKEN diff --git a/kubernetes/deployment-staging.tmpl b/kubernetes/deployment-staging.tmpl index f540e0fca3..2e49fd7848 100644 --- a/kubernetes/deployment-staging.tmpl +++ b/kubernetes/deployment-staging.tmpl @@ -59,7 +59,7 @@ spec: - containerPort: 3000 env: - name: PROJECT_ASSET_PREFIX - value: https://fe-project.preview.zooniverse.org/projects + value: https://frontend.preview.zooniverse.org/projects - name: COMMIT_ID value: __IMAGE_TAG__ - name: NEWRELIC_LICENSE_KEY @@ -151,7 +151,7 @@ spec: - containerPort: 3000 env: - name: CONTENT_ASSET_PREFIX - value: https://fe-content-pages.preview.zooniverse.org/about + value: https://frontend.preview.zooniverse.org/about - name: COMMIT_ID value: __IMAGE_TAG__ - name: CONTENTFUL_ACCESS_TOKEN diff --git a/packages/app-content-pages/public/robots.txt b/packages/app-content-pages/public/robots.txt new file mode 100644 index 0000000000..1f53798bb4 --- /dev/null +++ b/packages/app-content-pages/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/packages/app-project/public/simple-avatar.png b/packages/app-project/public/assets/simple-avatar.png similarity index 100% rename from packages/app-project/public/simple-avatar.png rename to packages/app-project/public/assets/simple-avatar.png diff --git a/packages/app-project/public/subject-placeholder.png b/packages/app-project/public/assets/subject-placeholder.png similarity index 100% rename from packages/app-project/public/subject-placeholder.png rename to packages/app-project/public/assets/subject-placeholder.png diff --git a/packages/app-project/public/robots.txt b/packages/app-project/public/robots.txt new file mode 100644 index 0000000000..1f53798bb4 --- /dev/null +++ b/packages/app-project/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/packages/app-project/src/screens/ClassifyPage/components/RecentSubjects/RecentSubjects.js b/packages/app-project/src/screens/ClassifyPage/components/RecentSubjects/RecentSubjects.js index 4000a71beb..3362b2e244 100644 --- a/packages/app-project/src/screens/ClassifyPage/components/RecentSubjects/RecentSubjects.js +++ b/packages/app-project/src/screens/ClassifyPage/components/RecentSubjects/RecentSubjects.js @@ -19,7 +19,7 @@ function RecentSubjects ({ const height = (size === 1) ? '40vw' : '200px' const { publicRuntimeConfig = {} } = getConfig() || {} const assetPrefix = publicRuntimeConfig.assetPrefix || '' - const placeholderUrl = `${assetPrefix}/subject-placeholder.png` + const placeholderUrl = `${assetPrefix}/assets/subject-placeholder.png` const displayedRecents = recents.slice(0, size) return ( diff --git a/packages/app-project/src/screens/ProjectAboutPage/components/TeamMember/TeamMember.js b/packages/app-project/src/screens/ProjectAboutPage/components/TeamMember/TeamMember.js index e083331edb..565c0b32d0 100644 --- a/packages/app-project/src/screens/ProjectAboutPage/components/TeamMember/TeamMember.js +++ b/packages/app-project/src/screens/ProjectAboutPage/components/TeamMember/TeamMember.js @@ -66,7 +66,7 @@ const TeamMember = ({ user }) => { const { publicRuntimeConfig = {} } = getConfig() || {} const assetPrefix = publicRuntimeConfig.assetPrefix || '' - const placeholderAvatar = `${assetPrefix}/simple-avatar.png` + const placeholderAvatar = `${assetPrefix}/assets/simple-avatar.png` return ( diff --git a/packages/app-project/src/shared/components/SubjectSetPicker/components/SubjectSetCard/SubjectSetCard.js b/packages/app-project/src/shared/components/SubjectSetPicker/components/SubjectSetCard/SubjectSetCard.js index 318b19d5e6..8e060102ae 100644 --- a/packages/app-project/src/shared/components/SubjectSetPicker/components/SubjectSetCard/SubjectSetCard.js +++ b/packages/app-project/src/shared/components/SubjectSetPicker/components/SubjectSetCard/SubjectSetCard.js @@ -26,7 +26,7 @@ function SubjectSetCard ({ const [subject] = subjects const { publicRuntimeConfig = {} } = getConfig() || {} const assetPrefix = publicRuntimeConfig.assetPrefix || '' - const placeholderUrl = `${assetPrefix}/subject-placeholder.png` + const placeholderUrl = `${assetPrefix}/assets/subject-placeholder.png` const subjectURLs = subject ? subject.locations.map(location => Object.values(location)[0]) : [] const alt = subject ? `Subject ${subject.id}` : 'Loading' const percentComplete = parseInt(100 * completeness)