- Mark Chang
- 0°C
- 4 年又 119 天
將Google字型fonts.googleapis.com新增到CSP header 中
Content Security Policy (CSP) 內容安全政策主要用來限制網頁中對外部的請求來源(例如:css,js(ajax,ws),webfont,img,video,iframe等等)
但這樣直接限制下去往往會影響到網站的正常運作。
以下是以.htaccess來開放Google字型fonts.googleapis.com
<IfModule mod_headers.c>
Header set Content-Security-Policy " \
default-src 'self'; \
img-src 'self' data:; \
font-src 'self' https://fonts.gstatic.com/; \
style-src 'self' https://fonts.googleapis.com/ 'unsafe-inline';\
"</IfModule>以白名單的形式允許信任的外部來源
以上紀錄~
https://innstory.com/story-將Google字型fontsgoogleapiscom新增到CSPheader中-2799
- 1,505
- 0
- 0

