資料載入中

胡言亂語

將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>

以白名單的形式允許信任的外部來源

以上紀錄~

  • 內容安全政策的應用與限制
  • 開放Google字型的設定方法
  • 使用.htaccess配置白名單
  • 網頁請求來源的管理策略
  • 影響網站正常運作的因素
https://innstory.com/story-將Google字型fontsgoogleapiscom新增到CSPheader中-2799

上一篇
 如何將ahref禁用

下一篇
分享【東京奧運開幕典禮】超級變變變!超創意呈現1964年的50個靜態項目圖標 

發表留言

作者簡介

離不開電腦的宅男


推薦閱讀

作者其他相關類別故事

Android Fragment及Activity 中使用sharedpreferences

Android Fragme…

Mark Chang 7 年又 175 天 2.5K

在Android下想要儲存執行資料的方式有好幾種,例如存在手機空間或者是資料庫空間。 這裡紀錄一下使...

php定時執行任務ignore_user_abort 函式

php定時執行任務ignor…

Mark Chang 6 年又 232 天 3.3K

ignoreuserabort() 函式 最近剛好有一個專案需要定時執行任務功能,原本一開始想到的是...

Fatal error Allowed memory size of 50331648 bytes exhausted tried to allocate 12288 bytes in

Fatal error Al…

Mark Chang 4 年又 314 天 1.8K

今天在客戶的網站系統上發現了一個問題。 在上傳檔案時發生了一個錯誤: 錯誤的原因: 因為php頁...