Skip to content

Commit c0f05f4

Browse files
committed
fix: add data: URI support to CSP for full page archives
Fixes #2621 When CRAWLER_FULL_PAGE_ARCHIVE=true is enabled, monolith generates full page archives with CSS inlined as data URIs (data:text/css;base64,...). The existing CSP header blocked these data URIs in the style-src directive, causing CSS to fail loading. Changes: - Add 'data:' to style-src directive for CSS data URIs - Add font-src directive with 'data:' support for inline fonts This allows monolith-generated archives to render correctly while maintaining CSP security for external resources.
1 parent 98e173d commit c0f05f4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/api/utils/assets.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export async function serveAsset(c: Context, assetId: string, userId: string) {
3434
"base-uri 'none'",
3535
"form-action 'none'",
3636
"img-src https: data: blob:",
37-
"style-src 'unsafe-inline' https:",
37+
"style-src 'unsafe-inline' https: data:",
38+
"font-src https: data:",
3839
"connect-src 'none'",
3940
"media-src https: data: blob:",
4041
"object-src 'none'",

0 commit comments

Comments
 (0)