Skip to content

Commit

Permalink
feat: add sitemap proxy (decentraland#548)
Browse files Browse the repository at this point in the history
* feat: add sitemap proxy

* fix: add root links
  • Loading branch information
2fd authored Jan 27, 2022
1 parent f2aba91 commit a77e035
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
5 changes: 5 additions & 0 deletions webapp/.ci/Pulumi.website-market-prd.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
encryptionsalt: v1:Ub7Ti35/fOE=:v1:ue70oeMNF/BRh6U/:ZQKwg/S7/BQ3BuP8bwATYtkm+KObIQ==
config:
aws:region: us-east-1
market-static:cloudflare_zone_id:
secure: v1:rJVlfoRG3TIQUlwc:HZaAAoafzch1ppfuUA1aLsOWMLWLkZyWQjWR/rveIA9cPrjQ5355EJtFzCVC8F7A
market-static:sitemaps_target:
secure: v1:W/l0/VqQ2z1ahF52:zLwhgfl7nUN8b6QsSHLY1xceOcpJc66MLBmg5JDgvuKw6z2kbyhlhb1EOXm0Wq/YZnm8OO4xWeeD0OKC1qFX+WR5RJrGSgwbVixD4LU0Bq24eWB7HA==
21 changes: 20 additions & 1 deletion webapp/.ci/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
import * as pulumi from '@pulumi/pulumi'
import * as cloudflare from '@pulumi/cloudflare'
import { env, envTLD } from 'dcl-ops-lib/domain'
import { buildStatic } from 'dcl-ops-lib/buildStatic'

async function main() {
const domain = `market.decentraland.${env === 'prd' ? 'org' : envTLD}`

const market = buildStatic({
domain: `market.decentraland.${env === 'prd' ? 'org' : envTLD}`,
domain,
defaultPath: 'index.html',
})

if (env === 'prd') {
const config = new pulumi.Config()
const hostHeaderOverride = config.requireSecret('sitemaps_target')
const zoneId = config.requireSecret('cloudflare_zone_id')
new cloudflare.PageRule(`marketplace-sitemaps-proxy`, {
zoneId,
target: domain + '/sitemap/*',
actions: {
ssl: 'flexible',
alwaysOnline: 'on',
hostHeaderOverride
}
})
}

return {
cloudfrontDistribution: market.cloudfrontDistribution,
bucketName: market.contentBucket,
Expand Down
6 changes: 6 additions & 0 deletions webapp/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
/>
<meta name="theme-color" content="#000000" />
<meta name="description" content="Decentraland - Marketplace" />
<link
rel="sitemap"
type="application/xml"
title="Sitemap"
href="%PUBLIC_URL%/sitemap.xml"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
Expand Down
4 changes: 4 additions & 0 deletions webapp/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
User-agent: *
Allow: /

Sitemap: https://market.decentraland.org/sitemap.xml
6 changes: 6 additions & 0 deletions webapp/public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://market.decentraland.org/sitemap/sitemap.urls.index.xml</loc>
</sitemap>
</sitemapindex>

0 comments on commit a77e035

Please sign in to comment.