]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_setenvif.xml.ja
XML update.
[apache] / docs / manual / mod / mod_setenvif.xml.ja
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
4 <!-- English Revision: 658546:1782252 (outdated) -->
5
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <modulesynopsis metafile="mod_setenvif.xml.meta">
24
25 <name>mod_setenvif</name>
26 <description>リクエストの特徴に基づいた環境変数の設定を可能にする</description>
27 <status>Base</status>
28 <sourcefile>mod_setenvif.c</sourcefile>
29 <identifier>setenvif_module</identifier>
30 <summary>
31
32     <p><module>mod_setenvif</module>
33     モジュールは、リクエストのある側面が指定された正規表現
34     に合うかどうかによって環境変数を設定する機能を提供します。
35     これらの環境変数を使用して、サーバの他の部分がどのような動作をするかを
36     決定することができます。</p>
37
38     <p>このモジュールが提供するディレクティブは、
39     設定ファイルに現れる順番に適用されます。
40     それを使って、次の例のようにより複雑な設定をすることができます。
41     これは、ブラウザが mozilla ではあるけれど、MSIE ではないときに
42     <code>netscape</code> を設定します。</p>
43 <example>
44   BrowserMatch ^Mozilla netscape<br />
45   BrowserMatch MSIE !netscape<br />
46 </example>
47 </summary>
48
49 <seealso><a href="../env.html">Apache の環境変数</a></seealso>
50
51 <directivesynopsis>
52 <name>BrowserMatch</name>
53 <description>HTTP User-Agent に基づいて環境変数を設定する
54 </description>
55 <syntax>BrowserMatch <em>regex [!]env-variable</em>[=<em>value</em>]
56 [[!]<em>env-variable</em>[=<em>value</em>]] ...</syntax>
57 <contextlist><context>server config</context>
58 <context>virtual host</context><context>directory</context>
59 <context>.htaccess</context></contextlist>
60 <override>FileInfo</override>
61
62 <usage>
63   <p><directive>BrowserMatch</directive> は
64   <directive module="mod_setenvif">SetEnvIf</directive> ディレクティブの
65   特例で、<code>User-Agent</code> HTTP リクエストヘッダに基づいて
66   環境変数を設定します。以下の 2 行の効果は同じになります:</p>
67
68 <example>
69    BrowserMatchNoCase Robot is_a_robot<br /> 
70    SetEnvIfNoCase User-Agent Robot is_a_robot<br /> 
71 </example>
72
73     <p>その他の例:</p>
74 <example>
75     BrowserMatch ^Mozilla forms jpeg=yes browser=netscape<br />
76     BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript<br />
77     BrowserMatch MSIE !javascript<br />
78 </example>
79 </usage>
80 </directivesynopsis>
81
82 <directivesynopsis>
83 <name>BrowserMatchNoCase</name>
84 <description>HTTP User-Agent に基づいて大文字小文字を区別せずに
85 環境変数を設定する</description>
86 <syntax>BrowserMatchNoCase  <em>regex [!]env-variable</em>[=<em>value</em>]
87     [[!]<em>env-variable</em>[=<em>value</em>]] ...</syntax>
88 <contextlist><context>server config</context>
89 <context>virtual host</context><context>directory</context>
90 <context>.htaccess</context></contextlist>
91 <override>FileInfo</override>
92
93 <usage>
94
95     <p><directive>BrowserMatchNoCase</directive> ディレクティブは
96     意味的には <directive
97     module="mod_setenvif">BrowserMatch</directive> ディレクティブと
98     同じです。ただし、このディレクティブは大文字小文字を区別しない
99     マッチングを行ないます。例えば:</p>
100
101 <example>
102     BrowserMatchNoCase mac platform=macintosh<br />
103     BrowserMatchNoCase win platform=windows<br />
104 </example>
105
106     <p><directive>BrowserMatch</directive> ディレクティブと
107     <directive>BrowserMatchNoCase</directive> ディレクティブは
108     <directive module="mod_setenvif">SetEnvIf</directive> ディレクティブと
109     <directive
110     module="mod_setenvif">SetEnvIfNoCase</directive> ディレクティブの
111     特例です。以下の 2 行の効果は同じです:</p>
112
113 <example>
114    BrowserMatchNoCase Robot is_a_robot<br />
115    SetEnvIfNoCase User-Agent Robot is_a_robot<br />
116 </example>
117 </usage>
118 </directivesynopsis>
119
120 <directivesynopsis>
121 <name>SetEnvIf</name>
122 <description>リクエストの属性に基づいて環境変数を設定する
123 </description>
124 <syntax>SetEnvIf <em>attribute
125     regex [!]env-variable</em>[=<em>value</em>]
126     [[!]<em>env-variable</em>[=<em>value</em>]] ...</syntax>
127 <contextlist><context>server config</context>
128 <context>virtual host</context><context>directory</context>
129 <context>.htaccess</context></contextlist>
130 <override>FileInfo</override>
131
132 <usage>
133     <p><directive>SetEnvIf</directive>
134     ディレクティブは、リクエストの属性に基づいて環境変数を定義します。
135     最初の引数で指定できる <em>attribute</em> は以下の 4 つのどれかです:</p>
136
137 <ol>
138 <li>HTTP リクエストヘッダフィールド (詳しい情報は <a
139     href="http://www.rfc-editor.org/rfc/rfc2616.txt">RFC 2616</a> を
140     参照してください)。例えば、<code>Host</code>,
141     <code>User-Agent</code>, <code>Referer</code>, 
142     <code>Accept-Language</code> です。リクエストヘッダの集合を現すために
143     正規表現を使うこともできます。</li>
144
145 <li>以下のリクエストの一部分のどれか:
146
147     <ul>
148       <li><code>Remote_Host</code> -
149       リクエストを行なっているクライアントのホスト名 (もしあれば)</li>
150
151       <li><code>Remote_Addr</code> -
152       リクエストを行なっているクライアントの IP アドレス</li>
153
154       <li><code>Server_Addr</code> - 
155       リクエストを受け取ったサーバの IP アドレス
156       (2.0.43 以降のみ)</li>
157
158       <li><code>Request_Method</code> -
159       使用されているメソッド名 (<code>GET</code>, <code>POST</code>
160       <em>など</em>)</li>
161
162       <li><code>Request_Protocol</code> -
163       リクエストが行なわれたプロトコルの名前とバージョン
164       (<em>例えば</em>、"HTTP/0.9", "HTTP/1.1" <em>など。</em>)</li>
165
166       <li><code>Request_URI</code> -
167       URL のスキームとホストの後の部分。
168       追加の情報として、クエリーストリングにマッチさせる場合については
169       <directive module="mod_rewrite">RewriteCond</directive>
170       ディレクティブを参照してください。</li>
171     </ul>
172 </li>
173
174 <li>リクエストと関連付けられる環境変数のリスト。これにより
175 <directive>SetEnvIf</directive> ディレクティブが以前のマッチの結果を
176 使うことができるようになります。この方法のテストでは前の部分にある
177 <code>SetEnvIf[NoCase]</code> の結果のみを使用可能です。「前」とは、
178 より広い範囲に対して定義されている (サーバ全体のように) か、現在のディレクティブの
179 範囲でより前の部分で定義されているか、ということです。
180 環境変数である可能性は、リクエストの特性に対するマッチが存在せず、
181 <em>attribute</em> に正規表現が使われなかったときにのみ考慮されます。</li>
182
183 <li>
184  SSL クライアント証明書拡張への参照で、<em>oid</em> オブジェクト ID 
185  で指定されるもの。
186  SSL リクエストでない場合や <em>oid</em> が設定されていなかった場合は、
187  変数はセットされません。<em>oid</em> が複数見つかった場合は
188  それらの文字列はカンマ <code>','</code> 区切りで連結されます。
189  <em>oid</em> は文字列型拡張への参照でなければなりません。
190 </li>
191 </ol>
192
193 <p>二つ目の引数 (<em>regex</em>) は <glossary ref="regex">正規表現</glossary>です。
194 これは POSIX.2 の egrep 形式の正規表現と似ています。<em>regex</em> が
195 <em>attribute</em> にマッチする場合は、残りの引数が評価されます。</p>
196
197 <p>残りの引数は設定する変数の名前で、設定される値を指定することもできます。
198 これは、</p>
199
200     <ol>
201       <li><code><em>varname</em></code></li>
202
203       <li><code>!<em>varname</em></code></li>
204
205       <li><code><em>varname</em>=<em>value</em></code></li>
206     </ol>
207
208     <p>のどれかの形式になります。</p>
209
210     <p>最初の形式では、値は "1" に設定されます。
211     二つ目はもし値が定義されていればそれを取り除きます。
212     三つ目は変数を <code><em>value</em></code> の与えられた値に設定します。
213     2.0.51 以降では、<var>value</var> 内に <code>$1</code>..<code>$9</code>
214     が存在すればそれを認識し、<var>regex</var> の対応する丸括弧で囲まれた部分で
215     置換します。</p>
216
217 <example>
218 <title>例:</title>
219    SetEnvIf Request_URI "\.gif$" object_is_image=gif<br />
220    SetEnvIf Request_URI "\.jpg$" object_is_image=jpg<br />
221    SetEnvIf Request_URI "\.xbm$" object_is_image=xbm<br />
222         :<br />
223    SetEnvIf Referer www\.mydomain\.example\.com intra_site_referral<br />
224         :<br />
225    SetEnvIf object_is_image xbm XBIT_PROCESSING=1<br />
226         :<br />
227    SetEnvIf OID("2.16.840.1.113730.1.13") "(.*)" NetscapeComment=$1<br />
228         :<br />
229    SetEnvIf ^TS*  ^[a-z].*  HAVE_TS<br />
230 </example>
231
232     <p>初めの三つはリクエストが画像であるときに環境変数
233     <code>object_is_image</code> を設定します。四つ目は
234     参照元のページがウェブサイト <code>www.mydomain.example.com</code> にあるときに
235     <code>intra_site_referral</code> を設定します。</p>
236
237     <p>6番目の例では環境変数 <code>NetscapeComment</code> を定義して、
238     その値が SSL クライアント証明書の対応するフィールドの文字列であるようにします。
239     ただし SSL クライアント証明書の対応するフィールドに文字列が存在する
240     ときにのみ、環境変数は設定されます。</p>
241
242     <p>最後の例は、リクエストに "TS" で始まり、値が集合 [a-z] のどれかで
243     始まるヘッダがあるときに <code>HAVE_TS</code> を設定します。</p>
244 </usage>
245
246 <seealso>他の例は、<a href="../env.html">Apache の環境変数</a>
247 </seealso>
248 </directivesynopsis>
249
250 <directivesynopsis>
251 <name>SetEnvIfExpr</name>
252 <description>Sets environment variables based on an ap_expr expression</description>
253 <contextlist><context>server config</context><context>virtual host</context><context>directory</context><context>.htaccess</context></contextlist>
254 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
255 </directivesynopsis>
256
257 <directivesynopsis>
258 <name>SetEnvIfNoCase</name>
259 <description>リクエストの属性に基づいて大文字小文字を区別せずに環境変数を設定する</description>
260 <syntax>SetEnvIfNoCase <em>attribute regex 
261         [!]env-variable</em>[=<em>value</em>]
262     [[!]<em>env-variable</em>[=<em>value</em>]] ...</syntax>
263 <contextlist><context>server config</context>
264 <context>virtual host</context><context>directory</context>
265 <context>.htaccess</context></contextlist>
266 <override>FileInfo</override>
267
268 <usage>
269
270     <p><directive>SetEnvIfNoCase</directive> は意味的には
271     <directive module="mod_setenvif">SetEnvIf</directive> ディレクティブと
272     同じです。違いは、正規表現のマッチングが大文字小文字を区別しないで
273     行なわれることです。例えば:</p>
274
275 <example>
276    SetEnvIfNoCase Host Apache\.Org site=apache
277 </example>
278
279     <p>これは HTTP リクエストヘッダにフィールド <code>Host:</code> が
280     あり、その値が <code>Apache.Org</code> や <code>apache.org</code>、
281     その他の大文字小文字の組み合わせであったときに <code>site</code>
282     環境変数を "<code>apache</code>" に設定します。</p>
283
284 </usage>
285 </directivesynopsis>
286 </modulesynopsis>