2 $Id: gfs-virtual.xml,v 1.4 2006-03-15 13:32:05 adam Exp $
3 Description of the virtual host mechanism in YAZ GFS
4 Included in both manual and man page for yaz-ztest
8 The Virtual hosts mechanism allows a YAZ frontend server to
9 support multiple backends. A backend is selected on the basis of
10 the TCP/IP binding (port+listening adddress) and/or the virtual host.
13 A backend can be configured to execute in a particular working
14 directory. Or the YAZ frontend may perform CQL to RPN conversion, thus
15 allowing traditional Z39.50 backends to be offered as a SRW/SRU
16 service. SRW/SRU Explain information for a particular backend may also
20 For the HTTP protocol, the virtual host is specified in the Host header.
21 For the Z39.50 protocol, the virtual host is specified as in the
22 Initialize Request in the OtherInfo, OID 1.2.840.10003.10.1000.81.1.
26 Not all Z39.50 clients allows the VHOST information to be set.
27 For those the selection of the backend must rely on the
28 TCP/IP information alone (port and address).
32 The YAZ frontend server uses XML to describe the backend
33 configurations. Command-line option <literal>-f</literal>
34 specifies filename of the XML configuration.
37 The configuration uses the root element <literal>yazgfs</literal>.
38 This element includes a list of <literal>listen</literal> elements,
39 followed by one or more <literal>server</literal> elements.
42 The <literal>listen</literal> describes listener (transport end point),
43 such as TCP/IP, Unix file socket or SSL server. Content for
46 <varlistentry><term>CDATA (required)</term>
49 The CDATA for the <literal>listen</literal> element holds the
50 listener string, such as <literal>tcp:@:210</literal>,
51 <literal>tcp:server1:2100</literal>,
56 <varlistentry><term>attribute <literal>id</literal> (optional)</term>
59 identifier for this listener. This may be referred to from
67 We expect more information to be added for the listen section in
68 a future version, such as CERT file for SSL servers.
73 The <literal>server</literal> describes a server and the parameters
74 for this server type. Content for a server:
76 <varlistentry><term>attribute <literal>id</literal> (optional)</term>
79 Identifier for this server. Currently not used for anything,
80 but it might be for logging purposes.
85 <varlistentry><term>attribute <literal>listenref</literal> (optional)</term>
88 Specifies listener for this server. If this attribute is not
89 given, the server is accessible from all listener. In order
90 for the server to be used for real, howeever, the virtual host
91 must match (if specified in the configuration).
96 <varlistentry><term>element <literal>config</literal> (optional)</term>
99 Specifies the server configuration. This is equivalent
100 to the config specified using command line option
101 <literal>-c</literal>.
106 <varlistentry><term>element <literal>directory</literal> (optional)</term>
109 Specifies a working directory for this backend server. If
110 specifid, the YAZ fronend changes current working directory
111 to this directory whenever a backend of this type is
112 started (backend handler bend_start), stopped (backend handler hand_stop)
113 and initialized (bend_init).
118 <varlistentry><term>element <literal>host</literal> (optional)</term>
121 Specifies the virtual host for this server. If this is specified
122 a client <emphasis>must</emphasis> specify this host string in
123 order to use this backend.
128 <varlistentry><term>element <literal>cql2rpn</literal> (optional)</term>
131 Specifies a filename that includes CQL to RPN conversion for this
132 backend server. See &reference-tools-cql-map;
133 If given, the backend server will only "see" a Type-1/RPN query.
138 <varlistentry><term>element <literal>stylesheet</literal> (optional)</term>
141 Specifies the stylesheet reference to be part of SRU HTTP responses
142 when the client does not specify one. If neither this is given, nor
143 the client specifies one, no stylesheet reference is part of the
149 <varlistentry><term>element <literal>docpath</literal> (optional)</term>
152 Specifies a path for local file access using HTTP. All URLs with
153 a leading prefix (/ exluded) that matches the value of docpath
154 are used for file access. For example, if the server is to offer
155 access in directory <literal>xsl</literal>, the docpath would be
156 <literal>xsl</literal> and all URLs of the form
157 <literal>http://host/exl</literal> will result in a local file access.
162 <varlistentry><term>element <literal>explain</literal> (optional)</term>
165 Specifies SRW/SRU ZeeRex content for this server. Copied verbatim
166 to the client. As things are now, some of the Explain content
167 seeem redundant because host information, etc. is also stored
176 The XML below configures a server that accepts connections from
177 two ports, TCP/IP port 9900 and a local UNIX file socket.
178 We name the TCP/IP server <literal>public</literal> and the
179 other server <literal>internal</literal>.
184 <listen id="public">tcp:@:9900</listen>
185 <listen id="internal">unix:/var/tmp/socket</listen>
186 <server id="server1">
187 <host>server1.mydomain</host>
188 <directory>/var/www/s1</directory>
189 <config>config.cfg</config>
191 <server id="server2">
192 <host>server2.mydomain</host>
193 <directory>/var/www/s2</directory>
194 <config>config.cfg</config>
195 <cql2rpn>../etc/pqf.properties</cql2rpn>
196 <explain xmlns="http://explain.z3950.org/dtd/2.0/">
198 <host>server2.mydomain</host>
200 <database>a</database>
204 <server id="server3" listenref="internal">
205 <directory>/var/www/s3</directory>
206 <config>config.cfg</config>
212 There are three configured backend servers. The first two
213 servers, <literal>"server1"</literal> and <literal>"server2"</literal>,
214 can be reached by both listener addresses - since
215 no <literal>listenref</literal> attribute is specified.
216 In order to distinguish between the two a virtual host has
217 been specified for each of server in the <literal>host</literal>
221 For <literal>"server2"</literal> elements for CQL to RPN conversion
222 is supported and explain information has been added (a short one here
223 to keep the example small).
226 The third server, <literal>"server3"</literal> can only be reached
227 via listener <literal>"internal"</literal>.
230 <!-- Keep this comment at the end of the file
235 sgml-minimize-attributes:nil
236 sgml-always-quote-attributes:t
239 sgml-parent-document: "yaz.xml"
240 sgml-local-catalogs: nil
241 sgml-namecase-general:t