Skip to content

Commit 1a3e917

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

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

static/_headers

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
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+
# - img-src: Allows Google profile pictures and branding
14+
# - connect-src: Allows network requests to Google's authentication endpoints
15+
# - style-src: Allows Google's CSS and inline styles
16+
# - font-src: Allows fonts from CDN, Google Fonts, and data URIs
17+
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; 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 https://cloud.logto.dev https://auth.logto.dev https://cloud.logto.io https://auth.logto.io; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://fonts.googleapis.com/css2; font-src 'self' data: https://cdn.jsdelivr.net https://fonts.googleapis.com/css2; object-src 'none'; base-uri 'self'; frame-src 'self' https://cloud.logto.dev https://auth.logto.dev https://cloud.logto.io https://auth.logto.io;

0 commit comments

Comments
 (0)