Initial commit
[yaz4j-moved-to-github.git] / dependencies / yaz-2.1.28 / doc / server.vhosts.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>7. Virtual Hosts</title><meta name="generator" content="DocBook XSL Stylesheets V1.70.1"><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. 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. 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 href="tools.html#tools.cql.map" 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">stylesheet</code> (optional)</span></dt><dd><p>
74      Specifies the stylesheet reference to be part of SRU HTTP responses
75      when the client does not specify one. If neither this is given, nor
76      the client specifies one, no stylesheet reference is part of the
77      SRU HTTP response.
78     </p></dd><dt><span class="term">element <code class="literal">docpath</code> (optional)</span></dt><dd><p>
79      Specifies a path for local file access using HTTP. All URLs with
80      a leading prefix (/ exluded) that matches the value of docpath
81      are used for file access. For example, if the server is to offer
82      access in directory <code class="literal">xsl</code>, the docpath would be
83      <code class="literal">xsl</code> and all URLs of the form
84      <code class="literal">http://host/exl</code> will result in a local file access.
85     </p></dd><dt><span class="term">element <code class="literal">explain</code> (optional)</span></dt><dd><p>
86      Specifies SRW/SRU ZeeRex content for this server. Copied verbatim
87      to the client. As things are now, some of the Explain content
88      seeem redundant because host information, etc. is also stored
89      elsewhere.
90     </p></dd></dl></div><p>
91 </p><p>
92  The XML below configures a server that accepts connections from
93  two ports, TCP/IP port 9900 and a local UNIX file socket.
94  We name the TCP/IP server <code class="literal">public</code> and the
95  other server <code class="literal">internal</code>.
96  </p><pre class="screen">
97   
98  &lt;yazgfs&gt;
99   &lt;listen id="public"&gt;tcp:@:9900&lt;/listen&gt;
100   &lt;listen id="internal"&gt;unix:/var/tmp/socket&lt;/listen&gt;
101   &lt;server id="server1"&gt;
102     &lt;host&gt;server1.mydomain&lt;/host&gt;
103     &lt;directory&gt;/var/www/s1&lt;/directory&gt;
104     &lt;config&gt;config.cfg&lt;/config&gt;
105   &lt;/server&gt;
106   &lt;server id="server2"&gt;
107     &lt;host&gt;server2.mydomain&lt;/host&gt;
108     &lt;directory&gt;/var/www/s2&lt;/directory&gt;
109     &lt;config&gt;config.cfg&lt;/config&gt;
110     &lt;cql2rpn&gt;../etc/pqf.properties&lt;/cql2rpn&gt;
111     &lt;explain xmlns="http://explain.z3950.org/dtd/2.0/"&gt;
112       &lt;serverInfo&gt;
113         &lt;host&gt;server2.mydomain&lt;/host&gt;
114         &lt;port&gt;9900&lt;/port&gt;
115         &lt;database&gt;a&lt;/database&gt;
116       &lt;/serverInfo&gt;
117     &lt;/explain&gt;
118   &lt;/server&gt;
119   &lt;server id="server3" listenref="internal"&gt;
120     &lt;directory&gt;/var/www/s3&lt;/directory&gt;
121     &lt;config&gt;config.cfg&lt;/config&gt;
122   &lt;/server&gt;
123  &lt;/yazgfs&gt;
124
125  </pre><p>
126  There are three configured backend servers. The first two
127  servers, <code class="literal">"server1"</code> and <code class="literal">"server2"</code>,
128  can be reached by both listener addresses - since
129  no <code class="literal">listenref</code> attribute is specified.
130  In order to distinguish between the two a virtual host has
131  been specified for each of server in the <code class="literal">host</code>
132  elements.
133 </p><p>
134  For <code class="literal">"server2"</code> elements for CQL to RPN conversion
135  is supported and explain information has been added (a short one here
136  to keep the example small).
137 </p><p>
138  The third server, <code class="literal">"server3"</code> can only be reached
139  via listener <code class="literal">"internal"</code>.
140 </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>