資料載入中

胡言亂語

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

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

以上紀錄~

  • 故事
  • CSP
  • Content Security Policy
  • 內容安全政策
  • Google字型
  • 白名單
https://innstory.com/story-將Google字型fontsgoogleapiscom新增到CSPheader中-2799

上一篇
 如何將ahref禁用

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

發表留言

作者簡介

離不開電腦的宅男


推薦閱讀

作者其他相關類別故事

PHP 字串字數計算並隱藏

PHP 字串字數計算並隱藏

Mark Chang 7 年又 90 天 2.2K

使用PHP substr函式可以做字串切割,但在遇到中文字時記得使用mbsubstr來做編碼,才...

Linux底下查看Mysql版本

Linux底下查看Mysql…

Mark Chang 4 年又 295 天 1.1K

在OS底下 在Mysql底下 以上紀錄~

PHP使用array_product函數求得陣列中的乘積

PHP使用array_pro…

Mark Chang 3 年又 128 天 1.1K

arrayproduct()是PHP中的一個內建函數,可以返回陣列中所有元素的乘積。 例如 若想要...