Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Move sitemap hostname back to audius.co #3931

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/web/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
User-agent: *
Allow: /

Sitemap: https://discoveryprovider.audius.co/sitemaps/default.xml
Sitemap: https://discoveryprovider.audius.co/sitemaps/track/index.xml
Sitemap: https://discoveryprovider.audius.co/sitemaps/playlist/index.xml
Sitemap: https://discoveryprovider.audius.co/sitemaps/user/index.xml
Sitemap: https://audius.co/sitemaps/default.xml
Sitemap: https://audius.co/sitemaps/track/index.xml
Sitemap: https://audius.co/sitemaps/playlist/index.xml
Sitemap: https://audius.co/sitemaps/user/index.xml
14 changes: 7 additions & 7 deletions packages/web/scripts/workers-site/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ async function handleEvent(event) {
return Response.redirect(url.origin, 302)
}

const isSitemap = pathname.startsWith('/sitemaps')
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

if (isSitemap) {
const destinationURL = discoveryNode + pathname + search + hash
const newRequest = new Request(destinationURL, event.request)
return await fetch(newRequest)
}

const userAgent = event.request.headers.get('User-Agent') || ''

const is204 = pathname === '/204'
Expand All @@ -259,13 +266,6 @@ async function handleEvent(event) {
return await fetch(newRequest)
}

const isSitemap = pathname.startsWith('/sitemaps')
if (isSitemap) {
const destinationURL = SITEMAP + pathname + search + hash
const newRequest = new Request(destinationURL, event.request)
return await fetch(newRequest)
}

const options = {}
// Always map requests to `/`
options.mapRequestToAsset = (request) => {
Expand Down
10 changes: 5 additions & 5 deletions packages/web/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ entry-point = "./scripts/workers-site"

[env.staging]
name = "audius-staging"
vars = { ENVIRONMENT = "staging", GA = "https://general-admission.staging.audius.co", SITEMAP = "http://staging.audius.co.s3-website-us-west-1.amazonaws.com", DISCOVERY_NODES = "https://discoveryprovider.staging.audius.co,https://discoveryprovider2.staging.audius.co,https://discoveryprovider3.staging.audius.co,https://discoveryprovider5.staging.audius.co" }
vars = { ENVIRONMENT = "staging", GA = "https://general-admission.staging.audius.co", DISCOVERY_NODES = "https://discoveryprovider.staging.audius.co,https://discoveryprovider2.staging.audius.co,https://discoveryprovider3.staging.audius.co,https://discoveryprovider5.staging.audius.co" }

[env.staging-release]
name = "audius-staging-release-candidate"
vars = { ENVIRONMENT = "staging", GA = "https://general-admission.staging.audius.co", SITEMAP = "http://staging.audius.co.s3-website-us-west-1.amazonaws.com", DISCOVERY_NODES = "https://discoveryprovider.staging.audius.co,https://discoveryprovider2.staging.audius.co,https://discoveryprovider3.staging.audius.co,https://discoveryprovider5.staging.audius.co" }
vars = { ENVIRONMENT = "staging", GA = "https://general-admission.staging.audius.co", DISCOVERY_NODES = "https://discoveryprovider.staging.audius.co,https://discoveryprovider2.staging.audius.co,https://discoveryprovider3.staging.audius.co,https://discoveryprovider5.staging.audius.co" }

[env.release]
name = "audius-release-candidate"
vars = { ENVIRONMENT = "production", GA = "https://general-admission.audius.co", SITEMAP = "http://audius.co.s3-website-us-west-1.amazonaws.com", DISCOVERY_NODES = "https://discoveryprovider.audius.co,https://discoveryprovider2.audius.co,https://discoveryprovider3.audius.co" }
vars = { ENVIRONMENT = "production", GA = "https://general-admission.audius.co", DISCOVERY_NODES = "https://discoveryprovider.audius.co,https://discoveryprovider2.audius.co,https://discoveryprovider3.audius.co" }

[env.production]
name = "audius"
vars = { ENVIRONMENT = "production", GA = "https://general-admission.audius.co", SITEMAP = "http://audius.co.s3-website-us-west-1.amazonaws.com", DISCOVERY_NODES = "https://discoveryprovider.audius.co,https://discoveryprovider2.audius.co,https://discoveryprovider3.audius.co" }
vars = { ENVIRONMENT = "production", GA = "https://general-admission.audius.co", DISCOVERY_NODES = "https://discoveryprovider.audius.co,https://discoveryprovider2.audius.co,https://discoveryprovider3.audius.co" }

# Test environment, replace `test` with subdomain
# Invoke with npx wrangler preview --watch --env test
[env.test]
name = "test"
vars = { ENVIRONMENT = "production", GA = "https://general-admission.audius.co", SITEMAP = "http://audius.co.s3-website-us-west-1.amazonaws.com", DISCOVERY_NODES = "https://discoveryprovider.audius.co,https://discoveryprovider2.audius.co,https://discoveryprovider3.audius.co" }
vars = { ENVIRONMENT = "production", GA = "https://general-admission.audius.co", DISCOVERY_NODES = "https://discoveryprovider.audius.co,https://discoveryprovider2.audius.co,https://discoveryprovider3.audius.co" }