| <?xml version="1.0" encoding="UTF-8" ?> |
| <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd"> |
| <?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?> |
| <!-- English Revision: 658546:1915443 (outdated) --> |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <modulesynopsis metafile="mod_setenvif.xml.meta"> |
| |
| <name>mod_setenvif</name> |
| <description>リクエストの特徴に基づいた環境変数の設定を可能にする</description> |
| <status>Base</status> |
| <sourcefile>mod_setenvif.c</sourcefile> |
| <identifier>setenvif_module</identifier> |
| <summary> |
| |
| <p><module>mod_setenvif</module> |
| モジュールは、リクエストのある側面が指定された正規表現 |
| に合うかどうかによって環境変数を設定する機能を提供します。 |
| これらの環境変数を使用して、サーバの他の部分がどのような動作をするかを |
| 決定することができます。</p> |
| |
| <p>このモジュールが提供するディレクティブは、 |
| 設定ファイルに現れる順番に適用されます。 |
| それを使って、次の例のようにより複雑な設定をすることができます。 |
| これは、ブラウザが mozilla ではあるけれど、MSIE ではないときに |
| <code>netscape</code> を設定します。</p> |
| <example> |
| BrowserMatch ^Mozilla netscape<br /> |
| BrowserMatch MSIE !netscape<br /> |
| </example> |
| </summary> |
| |
| <seealso><a href="../env.html">Apache の環境変数</a></seealso> |
| |
| <directivesynopsis> |
| <name>BrowserMatch</name> |
| <description>HTTP User-Agent に基づいて環境変数を設定する |
| </description> |
| <syntax>BrowserMatch <em>regex [!]env-variable</em>[=<em>value</em>] |
| [[!]<em>env-variable</em>[=<em>value</em>]] ...</syntax> |
| <contextlist><context>server config</context> |
| <context>virtual host</context><context>directory</context> |
| <context>.htaccess</context></contextlist> |
| <override>FileInfo</override> |
| |
| <usage> |
| <p><directive>BrowserMatch</directive> は |
| <directive module="mod_setenvif">SetEnvIf</directive> ディレクティブの |
| 特例で、<code>User-Agent</code> HTTP リクエストヘッダに基づいて |
| 環境変数を設定します。以下の 2 行の効果は同じになります:</p> |
| |
| <example> |
| BrowserMatchNoCase Robot is_a_robot<br /> |
| SetEnvIfNoCase User-Agent Robot is_a_robot<br /> |
| </example> |
| |
| <p>その他の例:</p> |
| <example> |
| BrowserMatch ^Mozilla forms jpeg=yes browser=netscape<br /> |
| BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript<br /> |
| BrowserMatch MSIE !javascript<br /> |
| </example> |
| </usage> |
| </directivesynopsis> |
| |
| <directivesynopsis> |
| <name>BrowserMatchNoCase</name> |
| <description>HTTP User-Agent に基づいて大文字小文字を区別せずに |
| 環境変数を設定する</description> |
| <syntax>BrowserMatchNoCase <em>regex [!]env-variable</em>[=<em>value</em>] |
| [[!]<em>env-variable</em>[=<em>value</em>]] ...</syntax> |
| <contextlist><context>server config</context> |
| <context>virtual host</context><context>directory</context> |
| <context>.htaccess</context></contextlist> |
| <override>FileInfo</override> |
| |
| <usage> |
| |
| <p><directive>BrowserMatchNoCase</directive> ディレクティブは |
| 意味的には <directive |
| module="mod_setenvif">BrowserMatch</directive> ディレクティブと |
| 同じです。ただし、このディレクティブは大文字小文字を区別しない |
| マッチングを行ないます。例えば:</p> |
| |
| <example> |
| BrowserMatchNoCase mac platform=macintosh<br /> |
| BrowserMatchNoCase win platform=windows<br /> |
| </example> |
| |
| <p><directive>BrowserMatch</directive> ディレクティブと |
| <directive>BrowserMatchNoCase</directive> ディレクティブは |
| <directive module="mod_setenvif">SetEnvIf</directive> ディレクティブと |
| <directive |
| module="mod_setenvif">SetEnvIfNoCase</directive> ディレクティブの |
| 特例です。以下の 2 行の効果は同じです:</p> |
| |
| <example> |
| BrowserMatchNoCase Robot is_a_robot<br /> |
| SetEnvIfNoCase User-Agent Robot is_a_robot<br /> |
| </example> |
| </usage> |
| </directivesynopsis> |
| |
| <directivesynopsis> |
| <name>SetEnvIf</name> |
| <description>リクエストの属性に基づいて環境変数を設定する |
| </description> |
| <syntax>SetEnvIf <em>attribute |
| regex [!]env-variable</em>[=<em>value</em>] |
| [[!]<em>env-variable</em>[=<em>value</em>]] ...</syntax> |
| <contextlist><context>server config</context> |
| <context>virtual host</context><context>directory</context> |
| <context>.htaccess</context></contextlist> |
| <override>FileInfo</override> |
| |
| <usage> |
| <p><directive>SetEnvIf</directive> |
| ディレクティブは、リクエストの属性に基づいて環境変数を定義します。 |
| 最初の引数で指定できる <em>attribute</em> は以下の 4 つのどれかです:</p> |
| |
| <ol> |
| <li>HTTP リクエストヘッダフィールド (詳しい情報は <a |
| href="http://www.rfc-editor.org/rfc/rfc2616.txt">RFC 2616</a> を |
| 参照してください)。例えば、<code>Host</code>, |
| <code>User-Agent</code>, <code>Referer</code>, |
| <code>Accept-Language</code> です。リクエストヘッダの集合を現すために |
| 正規表現を使うこともできます。</li> |
| |
| <li>以下のリクエストの一部分のどれか: |
| |
| <ul> |
| <li><code>Remote_Host</code> - |
| リクエストを行なっているクライアントのホスト名 (もしあれば)</li> |
| |
| <li><code>Remote_Addr</code> - |
| リクエストを行なっているクライアントの IP アドレス</li> |
| |
| <li><code>Server_Addr</code> - |
| リクエストを受け取ったサーバの IP アドレス |
| (2.0.43 以降のみ)</li> |
| |
| <li><code>Request_Method</code> - |
| 使用されているメソッド名 (<code>GET</code>, <code>POST</code> |
| <em>など</em>)</li> |
| |
| <li><code>Request_Protocol</code> - |
| リクエストが行なわれたプロトコルの名前とバージョン |
| (<em>例えば</em>、"HTTP/0.9", "HTTP/1.1" <em>など。</em>)</li> |
| |
| <li><code>Request_URI</code> - |
| URL のスキームとホストの後の部分。 |
| 追加の情報として、クエリーストリングにマッチさせる場合については |
| <directive module="mod_rewrite">RewriteCond</directive> |
| ディレクティブを参照してください。</li> |
| </ul> |
| </li> |
| |
| <li>リクエストと関連付けられる環境変数のリスト。これにより |
| <directive>SetEnvIf</directive> ディレクティブが以前のマッチの結果を |
| 使うことができるようになります。この方法のテストでは前の部分にある |
| <code>SetEnvIf[NoCase]</code> の結果のみを使用可能です。「前」とは、 |
| より広い範囲に対して定義されている (サーバ全体のように) か、現在のディレクティブの |
| 範囲でより前の部分で定義されているか、ということです。 |
| 環境変数である可能性は、リクエストの特性に対するマッチが存在せず、 |
| <em>attribute</em> に正規表現が使われなかったときにのみ考慮されます。</li> |
| |
| <li> |
| SSL クライアント証明書拡張への参照で、<em>oid</em> オブジェクト ID |
| で指定されるもの。 |
| SSL リクエストでない場合や <em>oid</em> が設定されていなかった場合は、 |
| 変数はセットされません。<em>oid</em> が複数見つかった場合は |
| それらの文字列はカンマ <code>','</code> 区切りで連結されます。 |
| <em>oid</em> は文字列型拡張への参照でなければなりません。 |
| </li> |
| </ol> |
| |
| <p>二つ目の引数 (<em>regex</em>) は <glossary ref="regex">正規表現</glossary>です。 |
| これは POSIX.2 の egrep 形式の正規表現と似ています。<em>regex</em> が |
| <em>attribute</em> にマッチする場合は、残りの引数が評価されます。</p> |
| |
| <p>残りの引数は設定する変数の名前で、設定される値を指定することもできます。 |
| これは、</p> |
| |
| <ol> |
| <li><code><em>varname</em></code></li> |
| |
| <li><code>!<em>varname</em></code></li> |
| |
| <li><code><em>varname</em>=<em>value</em></code></li> |
| </ol> |
| |
| <p>のどれかの形式になります。</p> |
| |
| <p>最初の形式では、値は "1" に設定されます。 |
| 二つ目はもし値が定義されていればそれを取り除きます。 |
| 三つ目は変数を <code><em>value</em></code> の与えられた値に設定します。 |
| 2.0.51 以降では、<var>value</var> 内に <code>$1</code>..<code>$9</code> |
| が存在すればそれを認識し、<var>regex</var> の対応する丸括弧で囲まれた部分で |
| 置換します。</p> |
| |
| <example> |
| <title>例:</title> |
| SetEnvIf Request_URI "\.gif$" object_is_image=gif<br /> |
| SetEnvIf Request_URI "\.jpg$" object_is_image=jpg<br /> |
| SetEnvIf Request_URI "\.xbm$" object_is_image=xbm<br /> |
| :<br /> |
| SetEnvIf Referer www\.mydomain\.example\.com intra_site_referral<br /> |
| :<br /> |
| SetEnvIf object_is_image xbm XBIT_PROCESSING=1<br /> |
| :<br /> |
| SetEnvIf OID("2.16.840.1.113730.1.13") "(.*)" NetscapeComment=$1<br /> |
| :<br /> |
| SetEnvIf ^TS* ^[a-z].* HAVE_TS<br /> |
| </example> |
| |
| <p>初めの三つはリクエストが画像であるときに環境変数 |
| <code>object_is_image</code> を設定します。四つ目は |
| 参照元のページがウェブサイト <code>www.mydomain.example.com</code> にあるときに |
| <code>intra_site_referral</code> を設定します。</p> |
| |
| <p>6番目の例では環境変数 <code>NetscapeComment</code> を定義して、 |
| その値が SSL クライアント証明書の対応するフィールドの文字列であるようにします。 |
| ただし SSL クライアント証明書の対応するフィールドに文字列が存在する |
| ときにのみ、環境変数は設定されます。</p> |
| |
| <p>最後の例は、リクエストに "TS" で始まり、値が集合 [a-z] のどれかで |
| 始まるヘッダがあるときに <code>HAVE_TS</code> を設定します。</p> |
| </usage> |
| |
| <seealso>他の例は、<a href="../env.html">Apache の環境変数</a> |
| </seealso> |
| </directivesynopsis> |
| |
| <directivesynopsis> |
| <name>SetEnvIfExpr</name> |
| <description>Sets environment variables based on an ap_expr expression</description> |
| <contextlist><context>server config</context><context>virtual host</context><context>directory</context><context>.htaccess</context></contextlist> |
| <usage><p>Documentation not yet translated. Please see English version of document.</p></usage> |
| </directivesynopsis> |
| |
| <directivesynopsis> |
| <name>SetEnvIfNoCase</name> |
| <description>リクエストの属性に基づいて大文字小文字を区別せずに環境変数を設定する</description> |
| <syntax>SetEnvIfNoCase <em>attribute regex |
| [!]env-variable</em>[=<em>value</em>] |
| [[!]<em>env-variable</em>[=<em>value</em>]] ...</syntax> |
| <contextlist><context>server config</context> |
| <context>virtual host</context><context>directory</context> |
| <context>.htaccess</context></contextlist> |
| <override>FileInfo</override> |
| |
| <usage> |
| |
| <p><directive>SetEnvIfNoCase</directive> は意味的には |
| <directive module="mod_setenvif">SetEnvIf</directive> ディレクティブと |
| 同じです。違いは、正規表現のマッチングが大文字小文字を区別しないで |
| 行なわれることです。例えば:</p> |
| |
| <example> |
| SetEnvIfNoCase Host Apache\.Org site=apache |
| </example> |
| |
| <p>これは HTTP リクエストヘッダにフィールド <code>Host:</code> が |
| あり、その値が <code>Apache.Org</code> や <code>apache.org</code>、 |
| その他の大文字小文字の組み合わせであったときに <code>site</code> |
| 環境変数を "<code>apache</code>" に設定します。</p> |
| |
| </usage> |
| </directivesynopsis> |
| </modulesynopsis> |