From 4cad9f931af8f1b331b040a84cfdc69da60220b6 Mon Sep 17 00:00:00 2001 From: zhangxiang Date: Tue, 18 Aug 2026 13:07:44 +0800 Subject: [PATCH] fix(nginx): allow googletagmanager in CSP img/connect sources GTM conversion tracking uses images from www.googletagmanager.com which were blocked by img-src, producing console errors on the homepage. --- nginx-static-production.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx-static-production.conf b/nginx-static-production.conf index 80586f4..7329352 100644 --- a/nginx-static-production.conf +++ b/nginx-static-production.conf @@ -125,7 +125,7 @@ http { add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; - add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.googletagmanager.com https://ssl.google-analytics.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https://www.google-analytics.com https://ssl.google-analytics.com; font-src 'self'; connect-src 'self' https://www.google-analytics.com https://ssl.google-analytics.com; frame-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self';" always; + add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.googletagmanager.com https://ssl.google-analytics.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https://www.google-analytics.com https://ssl.google-analytics.com https://www.googletagmanager.com; font-src 'self'; connect-src 'self' https://www.google-analytics.com https://ssl.google-analytics.com https://www.googletagmanager.com; frame-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self';" always; add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), interest-cohort=()" always; # 静态文件根目录