Skip to content
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
3 changes: 2 additions & 1 deletion scripts/build-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function projectHeaders(html: string, production: boolean): Record<string, strin
'X-Frame-Options': 'DENY',
'Permissions-Policy': 'geolocation=(), camera=(), microphone=(), payment=()',
...(production ? { 'Strict-Transport-Security': 'max-age=31536000' } : {}),
'Cache-Control': 'no-cache'
// Keep the host from rewriting mail links or injecting client scripts into this static artifact.
'Cache-Control': 'no-cache, no-transform'
};
}

Expand Down
1 change: 1 addition & 0 deletions tests/contracts/project-site.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ test('preview and production discovery policies stay distinct and aliases remain
assert.equal((await readFile(path.join(targets.preview, 'sitemap.xml'), 'utf8')).includes('<url>'), false);
assert.equal((await readFile(path.join(targets.production, 'sitemap.xml'), 'utf8')).match(/<loc>/g)?.length, 1);
const headers = await readFile(path.join(targets.production, '_headers'), 'utf8');
assert.equal(responseHeaders(headers, new URL('https://food-help.ca/'))['Cache-Control'], 'no-cache, no-transform');
assert.equal(responseHeaders(headers, new URL('https://food-help.ca/'))['X-Robots-Tag'], undefined);
assert.equal(responseHeaders(headers, new URL('https://project.pages.dev/'))['X-Robots-Tag'], 'noindex');
assert.equal(responseHeaders(headers, new URL('https://review.project.pages.dev/'))['X-Robots-Tag'], 'noindex');
Expand Down
Loading