Skip to content

Commit b08dd86

Browse files
author
Darcy Ye
committed
refactor: apply thorough CSP
1 parent 5e901be commit b08dd86

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

static/_headers

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
# Headers for Google Identity Services (One Tap)
2-
# Only apply COOP headers when Google One Tap is potentially active
3-
/
1+
# Headers for Google Identity Services (One Tap) and Content Security Policy
2+
# This configuration allows Google One Tap to work properly on Cloudflare Pages
3+
# Based on troubleshooting guide for resolving "Can't continue with google.com" errors
4+
5+
/*
6+
# Cross-Origin policies for Google One Tap
47
Cross-Origin-Opener-Policy: same-origin-allow-popups
5-
Referrer-Policy: no-referrer-when-downgrade
8+
Referrer-Policy: strict-origin-when-cross-origin
9+
10+
# Content Security Policy for Google One Tap integration
11+
# Essential CSP directives to prevent "Can't continue with google.com" errors:
12+
# - script-src: Allows Google Identity Services scripts
13+
# - frame-src: Allows Google One Tap iframe prompt
14+
# - img-src: Allows Google profile pictures and branding
15+
# - connect-src: Allows network requests to Google's authentication endpoints
16+
# - style-src: Allows Google's CSS and inline styles
17+
# - font-src: Allows fonts from CDN and data URIs
18+
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://accounts.google.com https://apis.google.com https://www.gstatic.com https://akasha.logto.io https://cdn.jsdelivr.net; frame-src 'self' https://accounts.google.com; img-src 'self' data: https: https://accounts.google.com https://lh3.googleusercontent.com; connect-src 'self' https://accounts.google.com https://oauth2.googleapis.com https://akasha.logto.io; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; font-src 'self' data: https://cdn.jsdelivr.net; object-src 'none'; base-uri 'self';

0 commit comments

Comments
 (0)