Content-Security-Policy: font-src directive

The HTTP Content-Security-Policy (CSP) font-src directive specifies valid sources for fonts loaded using @font-face.

CSP version1
Directive typeFetch directive
default-src fallbackYes. If this directive is absent, the user agent will look for the default-src directive.

Syntax

http
Content-Security-Policy: font-src 'none';
Content-Security-Policy: font-src <source-expression-list>;

This directive may have one of the following values:

'none'

No resources of this type may be loaded. The single quotes are mandatory.

<source-expression-list>

A space-separated list of source expression values. Resources of this type may be loaded if they match any of the given source expressions. For this directive, the following source expression values are applicable:

Examples

undefined

Violation cases

Given this CSP header:

http
Content-Security-Policy: font-src https://example.com/

The following font resource loading is blocked and won't load:

html
<style>
  @font-face {
    font-family: "MyFont";
    src: url("https://not-example.com/font");
  }
  body {
    font-family: "MyFont";
  }
</style>

Specifications

See also