Skip to content

Commit

Permalink
Add Cross-Origin-Resource-Policy header to embeddable files
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Apr 29, 2021
1 parent a7ebffa commit a068af3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion modules/actions/serveFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export default function serveFile(req, res) {
'Cache-Control': 'public, max-age=31536000', // 1 year
'Last-Modified': req.entry.lastModified,
ETag: etag(req.entry.content),
'Cache-Tag': tags.join(', ')
'Cache-Tag': tags.join(', '),
'Cross-Origin-Resource-Policy': 'cross-origin',
})
.send(req.entry.content);
}
3 changes: 2 additions & 1 deletion modules/actions/serveJavaScriptModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export default function serveJavaScriptModule(req, res) {
'Content-Type': getContentTypeHeader(req.entry.contentType),
'Cache-Control': 'public, max-age=31536000', // 1 year
ETag: etag(code),
'Cache-Tag': 'file, js-file, js-module'
'Cache-Tag': 'file, js-file, js-module',
'Cross-Origin-Resource-Policy': 'cross-origin',
})
.send(code);
} catch (error) {
Expand Down

0 comments on commit a068af3

Please sign in to comment.