Initial commit
[yaz4j-moved-to-github.git] / dependencies / yaz_3.0.14 / doc / server.vhosts.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>7. GFS Configuration and Virtual Hosts</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="YAZ User's Guide and Reference"><link rel="up" href="server.html" title="Chapter 4. Generic server"><link rel="prev" href="server.invocation.html" title="6. Application Invocation"><link rel="next" href="client.html" title="Chapter 5. The YAZ client"></head><body><link rel="stylesheet" type="text/css" href="common/style1.css"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">7. GFS Configuration and Virtual Hosts</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="server.invocation.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Generic server</th><td width="20%" align="right"> <a accesskey="n" href="client.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="server.vhosts"></a>7. GFS Configuration and Virtual Hosts</h2></div></div></div><p>
2  The Virtual hosts mechanism allows a YAZ frontend server to
3  support multiple backends. A backend is selected on the basis of
4  the TCP/IP binding (port+listening adddress) and/or the virtual host.
5 </p><p>
6  A backend can be configured to execute in a particular working
7  directory. Or the YAZ frontend may perform CQL to RPN conversion, thus
8  allowing traditional Z39.50 backends to be offered as a SRW/SRU
9  service. SRW/SRU Explain information for a particular backend may also
10  be specified.
11 </p><p>
12  For the HTTP protocol, the virtual host is specified in the Host header.
13  For the Z39.50 protocol, the virtual host is specified as in the
14  Initialize Request in the OtherInfo, OID 1.2.840.10003.10.1000.81.1.
15 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
16   Not all Z39.50 clients allows the VHOST information to be set.
17   For those the selection of the backend must rely on the
18   TCP/IP information alone (port and address).
19  </p></div><p>
20  The YAZ frontend server uses XML to describe the backend
21  configurations. Command-line option <code class="literal">-f</code> 
22  specifies filename of the XML configuration.
23 </p><p>
24  The configuration uses the root element <code class="literal">yazgfs</code>.
25  This element includes a list of <code class="literal">listen</code> elements,
26  followed by one or more <code class="literal">server</code> elements.
27 </p><p>
28  The <code class="literal">listen</code> describes listener (transport end point),
29  such as TCP/IP, Unix file socket or SSL server. Content for 
30  a listener:
31  </p><div class="variablelist"><dl><dt><span class="term">CDATA (required)</span></dt><dd><p>
32      The CDATA for the <code class="literal">listen</code> element holds the
33      listener string, such as <code class="literal">tcp:@:210</code>, 
34      <code class="literal">tcp:server1:2100</code>,
35      etc.
36     </p></dd><dt><span class="term">attribute <code class="literal">id</code> (optional)</span></dt><dd><p>
37       identifier for this listener. This may be referred to from
38       server sections.
39      </p></dd></dl></div><p>
40  </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
41    We expect more information to be added for the listen section in
42    a future version, such as CERT file for SSL servers.
43   </p></div><p>
44 </p><p>
45  The <code class="literal">server</code> describes a server and the parameters
46  for this server type. Content for a server:
47  </p><div class="variablelist"><dl><dt><span class="term">attribute <code class="literal">id</code> (optional)</span></dt><dd><p>
48      Identifier for this server. Currently not used for anything,
49      but it might be for logging purposes.
50    </p></dd><dt><span class="term">attribute <code class="literal">listenref</code> (optional)</span></dt><dd><p>
51      Specifies listener for this server. If this attribute is not
52      given, the server is accessible from all listener. In order
53      for the server to be used for real, howeever, the virtual host
54      must match (if specified in the configuration).
55     </p></dd><dt><span class="term">element <code class="literal">config</code> (optional)</span></dt><dd><p>
56      Specifies the server configuration. This is equivalent
57      to the config specified using command line option
58      <code class="literal">-c</code>.
59     </p></dd><dt><span class="term">element <code class="literal">directory</code> (optional)</span></dt><dd><p>
60      Specifies a working directory for this backend server. If
61      specifid, the YAZ fronend changes current working directory
62      to this directory whenever a backend of this type is
63      started (backend handler bend_start), stopped (backend handler hand_stop)
64      and initialized (bend_init).
65     </p></dd><dt><span class="term">element <code class="literal">host</code> (optional)</span></dt><dd><p>
66      Specifies the virtual host for this server. If this is specified
67      a client <span class="emphasis"><em>must</em></span> specify this host string in
68      order to use this backend.
69     </p></dd><dt><span class="term">element <code class="literal">cql2rpn</code> (optional)</span></dt><dd><p>
70      Specifies a filename that includes CQL to RPN conversion for this
71      backend server. See <a class="xref" href="tools.html#cql.to.rpn" title="1.3.4. Specification of CQL to RPN mappings">Section 1.3.4, &#8220;Specification of CQL to RPN mappings&#8221;</a>
72      If given, the backend server will only "see" a Type-1/RPN query. 
73     </p></dd><dt><span class="term">element <code class="literal">ccl2rpn</code> (optional)</span></dt><dd><p>
74      Specifies a filename that includes CCL to RPN conversion for this
75      backend server. See <a class="xref" href="tools.html#ccl.qualifiers" title="1.2.2. CCL Qualifiers">Section 1.2.2, &#8220;CCL Qualifiers&#8221;</a>
76      If given, the backend server will only "see" a Type-1/RPN query. 
77     </p></dd><dt><span class="term">element <code class="literal">stylesheet</code> (optional)</span></dt><dd><p>
78      Specifies the stylesheet reference to be part of SRU HTTP responses
79      when the client does not specify one. If neither this is given, nor
80      the client specifies one, no stylesheet reference is part of the
81      SRU HTTP response.
82     </p></dd><dt><span class="term">element <code class="literal">docpath</code> (optional)</span></dt><dd><p>
83      Specifies a path for local file access using HTTP. All URLs with
84      a leading prefix (/ exluded) that matches the value of docpath
85      are used for file access. For example, if the server is to offer
86      access in directory <code class="literal">xsl</code>, the docpath would be
87      <code class="literal">xsl</code> and all URLs of the form
88      <code class="literal">http://host/exl</code> will result in a local file access.
89     </p></dd><dt><span class="term">element <code class="literal">explain</code> (optional)</span></dt><dd><p>
90      Specifies SRW/SRU ZeeRex content for this server. Copied verbatim
91      to the client. As things are now, some of the Explain content
92      seeem redundant because host information, etc. is also stored
93      elsewhere.
94     </p></dd><dt><span class="term">element <code class="literal">maximumrecordsize</code> (optional)</span></dt><dd><p>
95      Specifies maximum record size/message size, in bytes. This
96      value also servers as maximum size of <span class="emphasis"><em>incoming</em></span>
97      packages (for Record Updates etc). It's the same value as that
98      given by the <code class="literal">-k</code> option.
99     </p></dd><dt><span class="term">element <code class="literal">retrievalinfo</code> (optional)</span></dt><dd><p>
100      Enables the retrieval facility supporting conversions and
101      specifications of record formats/types.
102      See <a class="xref" href="tools.retrieval.html" title="6. Retrieval Facility">Section 6, &#8220;Retrieval Facility&#8221;</a> for
103      more information.
104     </p></dd></dl></div><p>
105 </p><p>
106  The XML below configures a server that accepts connections from
107  two ports, TCP/IP port 9900 and a local UNIX file socket.
108  We name the TCP/IP server <code class="literal">public</code> and the
109  other server <code class="literal">internal</code>.
110  </p><pre class="screen">
111   
112  &lt;yazgfs&gt;
113   &lt;listen id="public"&gt;tcp:@:9900&lt;/listen&gt;
114   &lt;listen id="internal"&gt;unix:/var/tmp/socket&lt;/listen&gt;
115   &lt;server id="server1"&gt;
116     &lt;host&gt;server1.mydomain&lt;/host&gt;
117     &lt;directory&gt;/var/www/s1&lt;/directory&gt;
118     &lt;config&gt;config.cfg&lt;/config&gt;
119   &lt;/server&gt;
120   &lt;server id="server2"&gt;
121     &lt;host&gt;server2.mydomain&lt;/host&gt;
122     &lt;directory&gt;/var/www/s2&lt;/directory&gt;
123     &lt;config&gt;config.cfg&lt;/config&gt;
124     &lt;cql2rpn&gt;../etc/pqf.properties&lt;/cql2rpn&gt;
125     &lt;explain xmlns="http://explain.z3950.org/dtd/2.0/"&gt;
126       &lt;serverInfo&gt;
127         &lt;host&gt;server2.mydomain&lt;/host&gt;
128         &lt;port&gt;9900&lt;/port&gt;
129         &lt;database&gt;a&lt;/database&gt;
130       &lt;/serverInfo&gt;
131     &lt;/explain&gt;
132   &lt;/server&gt;
133   &lt;server id="server3" listenref="internal"&gt;
134     &lt;directory&gt;/var/www/s3&lt;/directory&gt;
135     &lt;config&gt;config.cfg&lt;/config&gt;
136   &lt;/server&gt;
137  &lt;/yazgfs&gt;
138
139  </pre><p>
140  There are three configured backend servers. The first two
141  servers, <code class="literal">"server1"</code> and <code class="literal">"server2"</code>,
142  can be reached by both listener addresses - since
143  no <code class="literal">listenref</code> attribute is specified.
144  In order to distinguish between the two a virtual host has
145  been specified for each of server in the <code class="literal">host</code>
146  elements.
147 </p><p>
148  For <code class="literal">"server2"</code> elements for CQL to RPN conversion
149  is supported and explain information has been added (a short one here
150  to keep the example small).
151 </p><p>
152  The third server, <code class="literal">"server3"</code> can only be reached
153  via listener <code class="literal">"internal"</code>.
154 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="server.invocation.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="server.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="client.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">6. Application Invocation </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 5. The YAZ client</td></tr></table></div></body></html>