Loading...

將Google字型fonts.googleapis.com新增到CSP header 中

Temperature: 0 °C

Mark ChangMark Chang
author_tools

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新增到CSP_header_中-2799
apache PHP

Prev
 如何將_a_href_禁用

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

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

使用jQuery阻止input直接按Enter就送出表單

使用jQuery阻止inpu...

使用表單是傳送資料裡經常會用到的方式。 這時當使用者輸入表單後習慣上按下Enter,則會將表單內容送...

jQuery resize取得瀏覽器目前視窗寬度

jQuery resize取...

pexelsphotokeyboard5 在使用CSS調整RWD顯示時~ 也可以使用javascri...

設置屬性 PHP PDO setAttribute

設置屬性 PHP PDO s...

PDO::ATTRCASE:強制列名為指定的大小寫。 PDO::CASELOWER:強制列名小寫。 ...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format