diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 06:33:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 06:33:50 +0000 |
commit | fe39ffb8b90ae4e002ed73fe98617cd590abb467 (patch) | |
tree | b80e5956907d8aeaaffe4e4f0c068c0e6157ce8b /docs/manual/mod/mod_brotli.html | |
parent | Initial commit. (diff) | |
download | apache2-upstream/2.4.56.tar.xz apache2-upstream/2.4.56.zip |
Adding upstream version 2.4.56.upstream/2.4.56upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | docs/manual/mod/mod_brotli.html | 9 | ||||
-rw-r--r-- | docs/manual/mod/mod_brotli.html.en | 349 | ||||
-rw-r--r-- | docs/manual/mod/mod_brotli.html.fr.utf8 | 360 |
3 files changed, 718 insertions, 0 deletions
diff --git a/docs/manual/mod/mod_brotli.html b/docs/manual/mod/mod_brotli.html new file mode 100644 index 0000000..dc9b5c2 --- /dev/null +++ b/docs/manual/mod/mod_brotli.html @@ -0,0 +1,9 @@ +# GENERATED FROM XML -- DO NOT EDIT + +URI: mod_brotli.html.en +Content-Language: en +Content-type: text/html; charset=UTF-8 + +URI: mod_brotli.html.fr.utf8 +Content-Language: fr +Content-type: text/html; charset=UTF-8 diff --git a/docs/manual/mod/mod_brotli.html.en b/docs/manual/mod/mod_brotli.html.en new file mode 100644 index 0000000..97afac1 --- /dev/null +++ b/docs/manual/mod/mod_brotli.html.en @@ -0,0 +1,349 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head> +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> +<!-- + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + This file is generated from xml source: DO NOT EDIT + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + --> +<title>mod_brotli - Apache HTTP Server Version 2.4</title> +<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> +<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> +<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" /> +<script src="../style/scripts/prettify.min.js" type="text/javascript"> +</script> + +<link href="../images/favicon.ico" rel="shortcut icon" /></head> +<body> +<div id="page-header"> +<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p> +<p class="apache">Apache HTTP Server Version 2.4</p> +<img alt="" src="../images/feather.png" /></div> +<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div> +<div id="path"> +<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.4</a> > <a href="./">Modules</a></div> +<div id="page-content"> +<div id="preamble"><h1>Apache Module mod_brotli</h1> +<div class="toplang"> +<p><span>Available Languages: </span><a href="../en/mod/mod_brotli.html" title="English"> en </a> | +<a href="../fr/mod/mod_brotli.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> +</div> +<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Compress content via Brotli before it is delivered to the +client</td></tr> +<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr> +<tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>brotli_module</td></tr> +<tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_brotli.c</td></tr> +<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.26 and later.</td></tr></table> +<h3>Summary</h3> + + <p>The <code class="module"><a href="../mod/mod_brotli.html">mod_brotli</a></code> module provides + the <code>BROTLI_COMPRESS</code> output filter that allows output from + your server to be compressed using the brotli compression format before being sent to the client over + the network. This module uses the Brotli library found at + <a href="https://github.com/google/brotli">https://github.com/google/brotli</a>.</p> +</div> +<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><h3>Topics</h3> +<ul id="topics"> +<li><img alt="" src="../images/down.gif" /> <a href="#recommended">Sample Configurations</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#enable">Enabling Compression</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#proxies">Dealing with proxy servers</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#precompressed">Serving pre-compressed +content</a></li> +</ul><h3 class="directives">Directives</h3> +<ul id="toc"> +<li><img alt="" src="../images/down.gif" /> <a href="#brotlialteretag">BrotliAlterETag</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#brotlicompressionmaxinputblock">BrotliCompressionMaxInputBlock</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#brotlicompressionquality">BrotliCompressionQuality</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#brotlicompressionwindow">BrotliCompressionWindow</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#brotlifilternote">BrotliFilterNote</a></li> +</ul> +<h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&list_id=144532&product=Apache%20httpd-2&query_format=specific&order=changeddate%20DESC%2Cpriority%2Cbug_severity&component=mod_brotli">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&component=mod_brotli">Report a bug</a></li></ul><h3>See also</h3> +<ul class="seealso"> +<li><a href="../filter.html">Filters</a></li> +<li><a href="#comments_section">Comments</a></li></ul></div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="section"> +<h2><a name="recommended" id="recommended">Sample Configurations</a></h2> + <div class="warning"><h3>Compression and TLS</h3> + <p>Some web applications are vulnerable to an information disclosure + attack when a TLS connection carries compressed data. For more + information, review the details of the "BREACH" family of attacks.</p> + </div> + <p>This is a simple configuration that compresses common text-based content types.</p> + + <div class="example"><h3>Compress only a few types</h3><pre class="prettyprint lang-config">AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript</pre> +</div> + +</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="section"> +<h2><a name="enable" id="enable">Enabling Compression</a></h2> + <div class="warning"><h3>Compression and TLS</h3> + <p>Some web applications are vulnerable to an information disclosure + attack when a TLS connection carries compressed data. For more + information, review the details of the "BREACH" family of attacks.</p> + </div> + + <h3><a name="output" id="output">Output Compression</a></h3> + <p>Compression is implemented by the <code>BROTLI_COMPRESS</code> + <a href="../filter.html">filter</a>. The following directive + will enable compression for documents in the container where it + is placed:</p> + + <pre class="prettyprint lang-config">SetOutputFilter BROTLI_COMPRESS +SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-brotli</pre> + + + <p>If you want to restrict the compression to particular MIME types + in general, you may use the <code class="directive"><a href="../mod/mod_filter.html#addoutputfilterbytype">AddOutputFilterByType</a></code> directive. Here is an example of + enabling compression only for the html files of the Apache + documentation:</p> + + <pre class="prettyprint lang-config"><Directory "/your-server-root/manual"> + AddOutputFilterByType BROTLI_COMPRESS text/html +</Directory></pre> + + + <div class="note"><h3>Note</h3> + The <code>BROTLI_COMPRESS</code> filter is always inserted after RESOURCE + filters like PHP or SSI. It never touches internal subrequests. + </div> + <div class="note"><h3>Note</h3> + There is an environment variable <code>no-brotli</code>, + set via <code class="directive"><a href="../mod/mod_env.html#setenv">SetEnv</a></code>, which + will disable brotli compression for a particular request, even if + it is supported by the client. + </div> + + + +</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="section"> +<h2><a name="proxies" id="proxies">Dealing with proxy servers</a></h2> + + <p>The <code class="module"><a href="../mod/mod_brotli.html">mod_brotli</a></code> module sends a <code>Vary: + Accept-Encoding</code> HTTP response header to alert proxies that + a cached response should be sent only to clients that send the + appropriate <code>Accept-Encoding</code> request header. This + prevents compressed content from being sent to a client that will + not understand it.</p> + + <p>If you use some special exclusions dependent + on, for example, the <code>User-Agent</code> header, you must + manually configure an addition to the <code>Vary</code> header + to alert proxies of the additional restrictions. For example, + in a typical configuration where the addition of the <code>BROTLI_COMPRESS</code> + filter depends on the <code>User-Agent</code>, you should add:</p> + + <pre class="prettyprint lang-config">Header append Vary User-Agent</pre> + + + <p>If your decision about compression depends on other information + than request headers (<em>e.g.</em> HTTP version), you have to set the + <code>Vary</code> header to the value <code>*</code>. This prevents + compliant proxies from caching entirely.</p> + + <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">Header set Vary *</pre> +</div> +</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="section"> +<h2><a name="precompressed" id="precompressed">Serving pre-compressed +content</a></h2> + + <p>Since <code class="module"><a href="../mod/mod_brotli.html">mod_brotli</a></code> re-compresses content each + time a request is made, some performance benefit can be derived by + pre-compressing the content and telling mod_brotli to serve them + without re-compressing them. This may be accomplished using a + configuration like the following:</p> + + <pre class="prettyprint lang-config"><IfModule mod_headers.c> + # Serve brotli compressed CSS files if they exist + # and the client accepts brotli. + RewriteCond "%{HTTP:Accept-encoding}" "br" + RewriteCond "%{REQUEST_FILENAME}\.br" "-s" + RewriteRule "^(.*)\.css" "$1\.css\.br" [QSA] + + # Serve brotli compressed JS files if they exist + # and the client accepts brotli. + RewriteCond "%{HTTP:Accept-encoding}" "br" + RewriteCond "%{REQUEST_FILENAME}\.br" "-s" + RewriteRule "^(.*)\.js" "$1\.js\.br" [QSA] + + + # Serve correct content types, and prevent double compression. + RewriteRule "\.css\.br$" "-" [T=text/css,E=no-brotli:1] + RewriteRule "\.js\.br$" "-" [T=text/javascript,E=no-brotli:1] + + + <FilesMatch "(\.js\.br|\.css\.br)$"> + # Serve correct encoding type. + Header append Content-Encoding br + + # Force proxies to cache brotli & + # non-brotli css/js files separately. + Header append Vary Accept-Encoding + </FilesMatch> +</IfModule></pre> + + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="BrotliAlterETag" id="BrotliAlterETag">BrotliAlterETag</a> <a name="brotlialteretag" id="brotlialteretag">Directive</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>How the outgoing ETag header should be modified during compression</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BrotliAlterETag AddSuffix|NoChange|Remove</code></td></tr> +<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>BrotliAlterETag AddSuffix</code></td></tr> +<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr> +<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_brotli</td></tr> +</table> + <p>The <code class="directive">BrotliAlterETag</code> directive specifies + how the ETag hader should be altered when a response is compressed.</p> + <dl> + <dt>AddSuffix</dt> + <dd><p>Append the compression method onto the end of the ETag, causing + compressed and uncompressed representations to have unique ETags. + In another dynamic compression module, mod_deflate, this has been + the default since 2.4.0. This setting prevents serving "HTTP Not + Modified" (304) responses to conditional requests for compressed + content.</p></dd> + <dt>NoChange</dt> + <dd><p>Don't change the ETag on a compressed response. In another dynamic + compression module, mod_deflate, this has been the default prior to + 2.4.0. This setting does not satisfy the HTTP/1.1 property that all + representations of the same resource have unique ETags. </p></dd> + <dt>Remove</dt> + <dd><p>Remove the ETag header from compressed responses. This prevents + some conditional requests from being possible, but avoids the + shortcomings of the preceding options. </p></dd> + </dl> + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="BrotliCompressionMaxInputBlock" id="BrotliCompressionMaxInputBlock">BrotliCompressionMaxInputBlock</a> <a name="brotlicompressionmaxinputblock" id="brotlicompressionmaxinputblock">Directive</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum input block size</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BrotliCompressionMaxInputBlock <var>value</var></code></td></tr> +<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>(automatic)</code></td></tr> +<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr> +<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_brotli</td></tr> +</table> + <p>The <code class="directive">BrotliCompressionMaxInputBlock</code> directive specifies + the maximum input block size between 16 and 24, with the caveat that + larger block sizes require more memory.</p> + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="BrotliCompressionQuality" id="BrotliCompressionQuality">BrotliCompressionQuality</a> <a name="brotlicompressionquality" id="brotlicompressionquality">Directive</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Compression quality</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BrotliCompressionQuality <var>value</var></code></td></tr> +<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>BrotliCompressionQuality 5</code></td></tr> +<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr> +<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_brotli</td></tr> +</table> + <p>The <code class="directive">BrotliCompressionQuality</code> directive specifies + the compression quality (a value between 0 and 11). Higher quality values + result in better, but also slower compression. + </p> + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="BrotliCompressionWindow" id="BrotliCompressionWindow">BrotliCompressionWindow</a> <a name="brotlicompressionwindow" id="brotlicompressionwindow">Directive</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Brotli sliding compression window size</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BrotliCompressionWindow <var>value</var></code></td></tr> +<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>BrotliCompressionWindow 18</code></td></tr> +<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr> +<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_brotli</td></tr> +</table> + <p>The <code class="directive">BrotliCompressionWindow</code> directive specifies the + brotli sliding compression window size (a value between 10 and 24). Larger + window sizes can improve compression quality, but require more memory.</p> + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="BrotliFilterNote" id="BrotliFilterNote">BrotliFilterNote</a> <a name="brotlifilternote" id="brotlifilternote">Directive</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Places the compression ratio in a note for logging</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BrotliFilterNote [<var>type</var>] <var>notename</var></code></td></tr> +<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr> +<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_brotli</td></tr> +</table> + <p>The <code class="directive">BrotliFilterNote</code> directive + specifies that a note about compression ratios should be attached + to the request. The name of the note is the value specified for + the directive. You can use that note for statistical purposes by + adding the value to your <a href="../logs.html#accesslog">access log</a>.</p> + + <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">BrotliFilterNote ratio + +LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' brotli +CustomLog "logs/brotli_log" brotli</pre> +</div> + + <p>If you want to extract more accurate values from your logs, you + can use the <var>type</var> argument to specify the type of data + left as a note for logging. <var>type</var> can be one of:</p> + + <dl> + <dt><code>Input</code></dt> + <dd>Store the byte count of the filter's input stream in the note.</dd> + + <dt><code>Output</code></dt> + <dd>Store the byte count of the filter's output stream in the note.</dd> + + <dt><code>Ratio</code></dt> + <dd>Store the compression ratio (<code>output/input * 100</code>) + in the note. This is the default, if the <var>type</var> argument + is omitted.</dd> + </dl> + + <p>Thus you may log it this way:</p> + + <div class="example"><h3>Accurate Logging</h3><pre class="prettyprint lang-config">BrotliFilterNote Input instream +BrotliFilterNote Output outstream +BrotliFilterNote Ratio ratio + +LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' brotli +CustomLog "logs/brotli_log" brotli</pre> +</div> + +<h3>See also</h3> +<ul> +<li><code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code></li> +</ul> +</div> +</div> +<div class="bottomlang"> +<p><span>Available Languages: </span><a href="../en/mod/mod_brotli.html" title="English"> en </a> | +<a href="../fr/mod/mod_brotli.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> +</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our <a href="https://httpd.apache.org/lists.html">mailing lists</a>.</div> +<script type="text/javascript"><!--//--><![CDATA[//><!-- +var comments_shortname = 'httpd'; +var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_brotli.html'; +(function(w, d) { + if (w.location.hostname.toLowerCase() == "httpd.apache.org") { + d.write('<div id="comments_thread"><\/div>'); + var s = d.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; + (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); + } + else { + d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); + } +})(window, document); +//--><!]]></script></div><div id="footer"> +<p class="apache">Copyright 2023 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> +<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> +</body></html>
\ No newline at end of file diff --git a/docs/manual/mod/mod_brotli.html.fr.utf8 b/docs/manual/mod/mod_brotli.html.fr.utf8 new file mode 100644 index 0000000..064aeca --- /dev/null +++ b/docs/manual/mod/mod_brotli.html.fr.utf8 @@ -0,0 +1,360 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"><head> +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> +<!-- + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + This file is generated from xml source: DO NOT EDIT + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + --> +<title>mod_brotli - Serveur HTTP Apache Version 2.4</title> +<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> +<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> +<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" /> +<script src="../style/scripts/prettify.min.js" type="text/javascript"> +</script> + +<link href="../images/favicon.ico" rel="shortcut icon" /></head> +<body> +<div id="page-header"> +<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossaire</a> | <a href="../sitemap.html">Plan du site</a></p> +<p class="apache">Serveur HTTP Apache Version 2.4</p> +<img alt="" src="../images/feather.png" /></div> +<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div> +<div id="path"> +<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">Serveur HTTP</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.4</a> > <a href="./">Modules</a></div> +<div id="page-content"> +<div id="preamble"><h1>Module Apache mod_brotli</h1> +<div class="toplang"> +<p><span>Langues Disponibles: </span><a href="../en/mod/mod_brotli.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="../fr/mod/mod_brotli.html" title="Français"> fr </a></p> +</div> +<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Compression du contenu via Brotli avant sa livraison au client</td></tr> +<tr><th><a href="module-dict.html#Status">Statut:</a></th><td>Extension</td></tr> +<tr><th><a href="module-dict.html#ModuleIdentifier">Identificateur de Module:</a></th><td>brotli_module</td></tr> +<tr><th><a href="module-dict.html#SourceFile">Fichier Source:</a></th><td>mod_brotli.c</td></tr> +<tr><th><a href="module-dict.html#Compatibility">Compatibilité:</a></th><td>Disponible à partir de la version 2.4.26 du serveur HTTP Apache</td></tr></table> +<h3>Sommaire</h3> + + <p>Le module <code class="module"><a href="../mod/mod_brotli.html">mod_brotli</a></code> fournit le filtre en sortie + <code>BROTLI_COMPRESS</code> qui permet de compresser un contenu avant sa + livraison au client en utilisant la bibliothèque brotli. Ce filtre est + implémenté en utilisant la bibliothèque Brotli que l'on peut trouver à <a href="https://github.com/google/brotli">https://github.com/google/brotli</a>.</p> +</div> +<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><h3>Sujets</h3> +<ul id="topics"> +<li><img alt="" src="../images/down.gif" /> <a href="#recommended">Exemples de configurations</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#enable">Activation de la compression</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#proxies">Interaction avec les serveurs mandataires</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#precompressed">Servir un contenu pré-compressé</a></li> +</ul><h3 class="directives">Directives</h3> +<ul id="toc"> +<li><img alt="" src="../images/down.gif" /> <a href="#brotlialteretag">BrotliAlterETag</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#brotlicompressionmaxinputblock">BrotliCompressionMaxInputBlock</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#brotlicompressionquality">BrotliCompressionQuality</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#brotlicompressionwindow">BrotliCompressionWindow</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#brotlifilternote">BrotliFilterNote</a></li> +</ul> +<h3>Traitement des bugs</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">Journal des modifications de httpd</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&list_id=144532&product=Apache%20httpd-2&query_format=specific&order=changeddate%20DESC%2Cpriority%2Cbug_severity&component=mod_brotli">Problèmes connus</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&component=mod_brotli">Signaler un bug</a></li></ul><h3>Voir aussi</h3> +<ul class="seealso"> +<li><a href="../filter.html">Filters</a></li> +<li><a href="#comments_section">Commentaires</a></li></ul></div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="section"> +<h2><a name="recommended" id="recommended">Exemples de configurations</a></h2> + <div class="warning"><h3>Compression et TLS</h3> + <p>Certaines applications web sont vulnérables à une attaque de type vol + d'informations lorsqu'une connexion TLS transmet des données + compressées. Pour plus d'informations, étudiez en détail la famille + d'attaques "BREACH".</p> + </div> + <p>Voici une configuration simple qui compresse des types de contenus + courants au format texte :</p> + + <div class="example"><h3>Compression de certains types seulement</h3><pre class="prettyprint lang-config">AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript</pre> +</div> + +</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="section"> +<h2><a name="enable" id="enable">Activation de la compression</a></h2> + <div class="warning"><h3>Compression et TLS</h3> + <p>Certaines applications web sont vulnérables à une attaque de type vol + d'informations lorsqu'une connexion TLS transmet des données + compressées. Pour plus d'informations, étudiez en détail la famille + d'attaques "BREACH".</p> + </div> + + <h3><a name="output" id="output">Compression en sortie</a></h3> + <p>La compression est implémentée par le <a href="../filter.html">filtre</a> <code>BROTLI_COMPRESS</code>. La + directive suivante active la compression pour les documents correspondant + au conteneur dans lequel elle est placée :</p> + + <pre class="prettyprint lang-config">SetOutputFilter BROTLI_COMPRESS +SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-brotli</pre> + + + <p>Si vous voulez restreindre la compression à certains types MIME + particuliers, vous pouvez utiliser la directive <code class="directive"><a href="../mod/mod_filter.html#addoutputfilterbytype">AddOutputFilterByType</a></code>. Dans l'exemple + suivant, l'activation de la compression est restreinte aux fichiers html + de la documentation d'Apache :</p> + + <pre class="prettyprint lang-config"><Directory "/your-server-root/manual"> + AddOutputFilterByType BROTLI_COMPRESS text/html +</Directory></pre> + + + <div class="note"><h3>Note</h3> + Le filtre <code>BROTLI_COMPRESS</code> est toujours inséré après les + filtres RESOURCE comme PHP ou SSI. Il n'affecte jamais les sous-requêtes + internes. + </div> + <div class="note"><h3>Note</h3> + Définie via <code class="directive"><a href="../mod/mod_env.html#setenv">SetEnv</a></code>, la variable + d'environnement <code>no-brotli</code> permet de désactiver la + compression brotli pour une requête particulière, et ceci même si elle + est supportée par le client. + </div> + + + +</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="section"> +<h2><a name="proxies" id="proxies">Interaction avec les serveurs mandataires</a></h2> + + <p>Le module <code class="module"><a href="../mod/mod_brotli.html">mod_brotli</a></code> envoie un en-tête de réponse HTTP + <code>Vary:Accept-Encoding</code> pour indiquer aux mandataires qu'une + réponse mise en cache ne doit être envoyée qu'aux clients qui envoient + l'en-tête de requête <code>Accept-Encoding</code> approprié. Ceci permet + d'éviter d'envoyer du contenu compressé à un client qui ne sera pas en + mesure de le décompresser.</p> + + <p>Si vous utilisez des exclusions spéciales dépendant, par exemple, de + l'en-tête <code>User-Agent</code>, vous devez faire un ajout manuel à + l'en-tête <code>Vary</code> afin d'informer les mandataires des restrictions + supplémentaires. Par exemple, dans une configuration typique où l'addition + du filtre <code>BROTLI_COMPRESS</code> dépend de l'en-tête <code>User-Agent</code>, + vous devez ajouter :</p> + + <pre class="prettyprint lang-config">Header append Vary User-Agent</pre> + + + <p>Si votre décision d'utiliser la compression ou non dépend d'autres + informations que le contenu d'en-têtes de requêtes (par exemple la version + HTTP), vous devez affecter la valeur <code>*</code> à l'en-tête + <code>Vary</code>. Ceci permet d'éviter que des mandataires qui le + supportent n'effectuent une mise en cache intégrale.</p> + + <div class="example"><h3>Exemple</h3><pre class="prettyprint lang-config">Header set Vary *</pre> +</div> +</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="section"> +<h2><a name="precompressed" id="precompressed">Servir un contenu pré-compressé</a></h2> + + <p>comme <code class="module"><a href="../mod/mod_brotli.html">mod_brotli</a></code> compresse systématiquement un contenu + pour chaque requête le concernant, il est possible d'obtenir un gain en + performance en pré-compressant le contenu et en disant à mod_brotli de le + servir sans le recompresser. Pour cela, vous pouvez utiliser une + configuration du style :</p> + + <pre class="prettyprint lang-config"><IfModule mod_headers.c> + # Sert des fichiers CSS compressés par brotli, s'ils existent + # et si le client supporte brotli. + RewriteCond "%{HTTP:Accept-encoding}" "br" + RewriteCond "%{REQUEST_FILENAME}\.br" "-s" + RewriteRule "^(.*)\.css" "$1\.css\.br" [QSA] + + # Sert des fichiers JS compressés par brotli, s'ils existent + # et si le client supporte brotli. + RewriteCond "%{HTTP:Accept-encoding}" "br" + RewriteCond "%{REQUEST_FILENAME}\.br" "-s" + RewriteRule "^(.*)\.js" "$1\.js\.br" [QSA] + + + # Sert des types de contenu corrects, et évite la double compression. + RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-brotli:1] + RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-brotli:1] + + + <FilesMatch "(\.js\.br|\.css\.br)$"> + # Sert un type d'encodage correct. + Header append Content-Encoding br + + # Force les mandataires à mettre en cache séparément les fichiers css/js + # compressés ou non par brotli. + Header append Vary Accept-Encoding + </FilesMatch> +</IfModule></pre> + + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="brotlialteretag" id="brotlialteretag">Directive</a> <a name="BrotliAlterETag" id="BrotliAlterETag">BrotliAlterETag</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Comment l'en-tête de réponse ETag doit être modifié au cours de la +compression</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntaxe:</a></th><td><code>BrotliAlterETag AddSuffix|NoChange|Remove</code></td></tr> +<tr><th><a href="directive-dict.html#Default">Défaut:</a></th><td><code>BrotliAlterETag AddSuffix</code></td></tr> +<tr><th><a href="directive-dict.html#Context">Contexte:</a></th><td>configuration globale, serveur virtuel</td></tr> +<tr><th><a href="directive-dict.html#Status">Statut:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_brotli</td></tr> +</table> + <p>La directive <code class="directive">BrotliAlterETag</code> permet d'indiquer + comment l'en-tête ETag doit être modifié lorsqu'une réponse est compressée.</p> + <dl> + <dt>AddSuffix</dt> + <dd><p>Ajoute la méthode de compression à la fin de l'en-tête ETag, ce qui + implique que les représentations compressées et non compressées possèderont + des en-têtes ETag uniques. C'est le comportement par défaut depuis la + version 2.4.0 avec un autre module de compression dynamique, + mod-deflate. Ce paramètre permet d'éviter l'envoi de messages + "HTTP Not Modified" (304) en réponse aux requêtes conditionnelles pour des + contenus compressés.</p></dd> + <dt>NoChange</dt> + <dd><p>Ne modifie pas l'en-tête ETag d'une réponse compressée. C'était le + comportement par défaut avant la version 2.4.0 avec un autre module de + compression dynamique, mod-deflate. Ce paramètre ne respecte pas la + propriété HTTP/1.1 selon laquelle toutes les représentations d'une même + ressource ont des en-têtes ETag uniques.</p></dd> + <dt>Remove</dt> + <dd><p>Supprime l'en-tête ETag des réponses compressées, ce qui rend + impossibles certaines requêtes conditionnelles, mais évite les inconvénients + des options précédentes.</p></dd> + </dl> + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="brotlicompressionmaxinputblock" id="brotlicompressionmaxinputblock">Directive</a> <a name="BrotliCompressionMaxInputBlock" id="BrotliCompressionMaxInputBlock">BrotliCompressionMaxInputBlock</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Taille maximale du bloc de données en entrée</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntaxe:</a></th><td><code>BrotliCompressionMaxInputBlock <var>value</var></code></td></tr> +<tr><th><a href="directive-dict.html#Default">Défaut:</a></th><td><code>(automatic)</code></td></tr> +<tr><th><a href="directive-dict.html#Context">Contexte:</a></th><td>configuration globale, serveur virtuel</td></tr> +<tr><th><a href="directive-dict.html#Status">Statut:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_brotli</td></tr> +</table> + <p>La directive <code class="directive">BrotliCompressionMaxInputBlock</code> permet + de spécifier la taille maximale du bloc de données en entrée entre 16 et 24, + sachant que plus cette taille sera grande, plus grande sera la quantité de + mémoire consommée.</p> + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="brotlicompressionquality" id="brotlicompressionquality">Directive</a> <a name="BrotliCompressionQuality" id="BrotliCompressionQuality">BrotliCompressionQuality</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Qualité de la compression</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntaxe:</a></th><td><code>BrotliCompressionQuality <var>value</var></code></td></tr> +<tr><th><a href="directive-dict.html#Default">Défaut:</a></th><td><code>BrotliCompressionQuality 5</code></td></tr> +<tr><th><a href="directive-dict.html#Context">Contexte:</a></th><td>configuration globale, serveur virtuel</td></tr> +<tr><th><a href="directive-dict.html#Status">Statut:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_brotli</td></tr> +</table> + <p>La directive <code class="directive">BrotliCompressionQuality</code> permet de + spécifier la qualité de la compression (une valeur entre 0 et + 11). Les valeurs les plus hautes correspondent à une compression de + meilleure qualité mais plus lente. + </p> + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="brotlicompressionwindow" id="brotlicompressionwindow">Directive</a> <a name="BrotliCompressionWindow" id="BrotliCompressionWindow">BrotliCompressionWindow</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Taille de la fenêtre de compression glissante brotli</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntaxe:</a></th><td><code>BrotliCompressionWindow <var>value</var></code></td></tr> +<tr><th><a href="directive-dict.html#Default">Défaut:</a></th><td><code>BrotliCompressionWindow 18</code></td></tr> +<tr><th><a href="directive-dict.html#Context">Contexte:</a></th><td>configuration globale, serveur virtuel</td></tr> +<tr><th><a href="directive-dict.html#Status">Statut:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_brotli</td></tr> +</table> + <p>La directive <code class="directive">BrotliCompressionWindow</code> permet de + spécifier la taille de la fenêtre de compression glissante brotli (une + valeur comprise entre 10 et 24). Une taille de fenêtre plus grande peut + améliorer la qualité de la compression mais consomme d'avantage de mémoire.</p> + +</div> +<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="directive-section"><h2><a name="brotlifilternote" id="brotlifilternote">Directive</a> <a name="BrotliFilterNote" id="BrotliFilterNote">BrotliFilterNote</a></h2> +<table class="directive"> +<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enregistre le taux de compression dans une note à des fins de +journalisation</td></tr> +<tr><th><a href="directive-dict.html#Syntax">Syntaxe:</a></th><td><code>BrotliFilterNote [<var>type</var>] <var>notename</var></code></td></tr> +<tr><th><a href="directive-dict.html#Context">Contexte:</a></th><td>configuration globale, serveur virtuel</td></tr> +<tr><th><a href="directive-dict.html#Status">Statut:</a></th><td>Extension</td></tr> +<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_brotli</td></tr> +</table> + <p>La directive <code class="directive">BrotliFilterNote</code> permet d'indiquer + qu'une note à propos du taux de compression doit être attachée à la + requête. L'argument <var>notename</var> permet de spécifier le nom de la + note. Vous pouvez utiliser cette note à des fins de statistiques en ajoutant + l'information correspondante à votre <a href="../logs.html#accesslog">access + log</a>.</p> + + <div class="example"><h3>Exemple</h3><pre class="prettyprint lang-config">BrotliFilterNote ratio + +LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' brotli +CustomLog "logs/brotli_log" brotli</pre> +</div> + + <p>Si vous souhaitez que l'information enregistrée dans vos journaux soit + plus pertinente, vous pouvez renseigner l'argument optionnel <var>type</var> + afin de spécifier le type de données à enregistrer dans la note à + journaliser. L'argument <var>type</var> accepte les valeurs suivantes :</p> + + <dl> + <dt><code>Input</code></dt> + <dd>Enregistre dans la note le nombre d'octets contenus dans le flux + d'entrée du filtre.</dd> + + <dt><code>Output</code></dt> + <dd>Enregistre dans la note le nombre d'octets contenus dans le flux + de sortie du filtre.</dd> + + <dt><code>Ratio</code></dt> + <dd>Enregistre dans la note le taux de compression (<code>output/input * + 100</code>). Il s'agit de l'option par défaut si l'argument + <var>type</var> est omis.</dd> + </dl> + + <p>Vous pouvez alors configurer vos journaux de la manière suivante :</p> + + <div class="example"><h3>Journalisation spécifique</h3><pre class="prettyprint lang-config">BrotliFilterNote Input instream +BrotliFilterNote Output outstream +BrotliFilterNote Ratio ratio + +LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' brotli +CustomLog "logs/brotli_log" brotli</pre> +</div> + +<h3>Voir aussi</h3> +<ul> +<li><code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code></li> +</ul> +</div> +</div> +<div class="bottomlang"> +<p><span>Langues Disponibles: </span><a href="../en/mod/mod_brotli.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="../fr/mod/mod_brotli.html" title="Français"> fr </a></p> +</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Commentaires</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our <a href="https://httpd.apache.org/lists.html">mailing lists</a>.</div> +<script type="text/javascript"><!--//--><![CDATA[//><!-- +var comments_shortname = 'httpd'; +var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_brotli.html'; +(function(w, d) { + if (w.location.hostname.toLowerCase() == "httpd.apache.org") { + d.write('<div id="comments_thread"><\/div>'); + var s = d.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; + (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); + } + else { + d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); + } +})(window, document); +//--><!]]></script></div><div id="footer"> +<p class="apache">Copyright 2023 The Apache Software Foundation.<br />Autorisé sous <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> +<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossaire</a> | <a href="../sitemap.html">Plan du site</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> +</body></html>
\ No newline at end of file |