diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/http/headers/content-security-policy/base-uri | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/ja/web/http/headers/content-security-policy/base-uri')
-rw-r--r-- | files/ja/web/http/headers/content-security-policy/base-uri/index.html | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/files/ja/web/http/headers/content-security-policy/base-uri/index.html b/files/ja/web/http/headers/content-security-policy/base-uri/index.html new file mode 100644 index 0000000000..95e5a39ca6 --- /dev/null +++ b/files/ja/web/http/headers/content-security-policy/base-uri/index.html @@ -0,0 +1,108 @@ +--- +title: 'CSP: base-uri' +slug: Web/HTTP/Headers/Content-Security-Policy/base-uri +tags: + - CSP + - Directive + - Document directive + - HTTP + - Security +translation_of: Web/HTTP/Headers/Content-Security-Policy/base-uri +--- +<div>{{HTTPSidebar}}</div> + +<p>HTTP {{HTTPHeader("Content-Security-Policy")}} の <strong><code>base-uri</code></strong> ディレクティブは、ドキュメントの要素 {{HTMLElement("base")}} で、使用できる URL を制限します。この値が存在しない場合は、任意の URI が許可されます。このディレクティブが存在しない場合、ユーザーエージェントは、{{HTMLElement("base")}} 要素の値を使用します。</p> + +<table class="properties"> + <tbody> + <tr> + <th scope="row">CSP version</th> + <td>2</td> + </tr> + <tr> + <th scope="row">Directive type</th> + <td>{{Glossary("Document directive")}}</td> + </tr> + <tr> + <th scope="row">{{CSP("default-src")}} fallback</th> + <td>設定しないと、任意の URL が許可されます。</td> + </tr> + </tbody> +</table> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<p>1 つまたは複数のソースを base-uri ポリシーに使用:</p> + +<pre class="syntaxbox">Content-Security-Policy: base-uri <source>; +Content-Security-Policy: base-uri <source> <source>; +</pre> + +<h3 id="Sources" name="Sources">ソース</h3> + +<p>このディレクティブは他の CSP ディレクティブと同じ引数を使用しますが、キーワードの <code>'unsafe-inline'</code> や <code>'strict-dynamic'</code> などは意味がありません。</p> + +<p>{{page("ja/docs/Web/HTTP/Headers/Content-Security-Policy/default-src", "Sources")}}</p> + +<h2 id="Examples" name="Examples">例</h2> + +<h3 id="Meta_tag_configuration" name="Meta_tag_configuration">Meta タグの設定</h3> + +<pre class="brush: html"><meta http-equiv="Content-Security-Policy" content="base-uri 'self'"></pre> + +<h3 id="Apache_configuration" name="Apache_configuration">Apache の設定</h3> + +<pre class="brush: bash"><IfModule mod_headers.c> +Header set Content-Security-Policy "base-uri 'self'"; +</IfModule></pre> + +<h3 id="Nginx_configuration" name="Nginx_configuration">Nginx の設定</h3> + +<pre class="brush: bash">add_header Content-Security-Policy "base-uri 'self';"</pre> + +<h3 id="Violation_case" name="Violation_case">違反になる場合</h3> + +<p>ドメインが <code>example.com</code> でないので、<code>https://example.com</code> に設定された {{HTMLElement("base")}} 要素の <code>href</code> が CSP 違反になります。</p> + +<pre class="brush: html; example-bad"><meta http-equiv="Content-Security-Policy" content="base-uri 'self'"> +<base href="https://example.com/"> + +// Error: Refused to set the document's base URI to 'https://example.com/' +// because it violates the following Content Security Policy +// directive: "base-uri 'self'"</pre> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様書</th> + <th scope="col">状態</th> + <th scope="col">備考</th> + </tr> + <tr> + <td>{{specName("CSP 3.0", "#directive-base-uri", "base-uri")}}</td> + <td>{{Spec2('CSP 3.0')}}</td> + <td>変更無し</td> + </tr> + <tr> + <td>{{specName("CSP 1.1", "#directive-base-uri", "base-uri")}}</td> + <td>{{Spec2('CSP 1.1')}}</td> + <td>初回定義</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("http.headers.csp.base-uri")}}</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{HTTPheader("Content-Security-Policy")}}</li> + <li>{{HTMLElement("base")}}</li> + <li>{{domxref("Node.baseURI")}}</li> +</ul> |