diff --git a/__tests__/sitemaps.ts b/__tests__/sitemaps.ts index 49211c0e10..ae74f9cc0f 100644 --- a/__tests__/sitemaps.ts +++ b/__tests__/sitemaps.ts @@ -287,7 +287,7 @@ describe('GET /sitemaps/agents-digest.xml', () => { expect(res.header['content-type']).toContain('application/xml'); expect(res.header['cache-control']).toEqual( - 'public, max-age=14400, s-maxage=14400', + 'public, max-age=7200, s-maxage=7200', ); expect(res.text).toContain( '', @@ -323,7 +323,7 @@ describe('GET /sitemaps/squads.xml', () => { expect(res.header['content-type']).toContain('application/xml'); expect(res.header['cache-control']).toEqual( - 'public, max-age=14400, s-maxage=14400', + 'public, max-age=7200, s-maxage=7200', ); expect(res.text).toContain( '', diff --git a/src/routes/sitemaps.ts b/src/routes/sitemaps.ts index 2e633bb930..252c05209e 100644 --- a/src/routes/sitemaps.ts +++ b/src/routes/sitemaps.ts @@ -12,6 +12,7 @@ import { import { AGENTS_DIGEST_SOURCE } from '../entity/Source'; import createOrGetConnection from '../db'; import { Readable } from 'stream'; +import { ONE_HOUR_IN_SECONDS } from '../common/constants'; import { DataSource, EntityManager, @@ -19,7 +20,7 @@ import { SelectQueryBuilder, } from 'typeorm'; -const SITEMAP_CACHE_CONTROL = 'public, max-age=14400, s-maxage=14400'; +const SITEMAP_CACHE_CONTROL = `public, max-age=${2 * ONE_HOUR_IN_SECONDS}, s-maxage=${2 * ONE_HOUR_IN_SECONDS}`; const SITEMAP_LIMIT = 50_000; const ARENA_SITEMAP_GROUP_IDS = [ '385404b4-f0f4-4e81-a338-bdca851eca31',