The Virtual hosts mechanism allows a YAZ front-end server to support multiple back-ends. A back-end is selected on the basis of the TCP/IP binding (port+listening address) and/or the virtual host.
A back-end can be configured to execute in a particular working directory. Or the YAZ front-end may perform CQL to RPN conversion, thus allowing traditional Z39.50 back-ends to be offered as a SRW/SRU service. SRW/SRU Explain information for a particular back-end may also be specified.
For the HTTP protocol, the virtual host is specified in the Host header. For the Z39.50 protocol, the virtual host is specified as in the Initialize Request in the OtherInfo, OID 1.2.840.10003.10.1000.81.1.
Not all Z39.50 clients allow the VHOST information to be set. For those, the selection of the back-end must rely on the TCP/IP information alone (port and address).
The YAZ front-end server uses XML to describe the back-end
configurations. Command-line option
specifies filename of the XML configuration.
The configuration uses the root element
This element includes a list of
followed by one or more
listen describes listener (transport end point),
such as TCP/IP, Unix file socket or SSL server. Content for
The CDATA for the
listen element holds the
listener string, such as
Identifier for this listener. This may be referred to from server sections.
We expect more information to be added for the listen section in a future version, such as CERT file for SSL servers.
server describes a server and the parameters
for this server type. Content for a server:
Identifier for this server. Currently not used for anything, but it might be for logging purposes.
Specifies one or more listeners for this server. Each server ID is separated by a comma. If this attribute is not given, the server is accessible from all listeners. In order for the server to be used for real, however, the virtual host must match if specified in the configuration.
Specifies the server configuration. This is equivalent
to the config specified using command line option
Specifies a working directory for this backend server. If specified, the YAZ frontend changes current working directory to this directory whenever a backend of this type is started (backend handler bend_start), stopped (backend handler hand_stop) and initialized (bend_init).
Specifies the virtual host for this server. If this is specified a client must specify this host string in order to use this backend.
Specifies a filename that includes CQL to RPN conversion for this backend server. See Section 1.3.4, “Specification of CQL to RPN mappings”. If given, the backend server will only "see" a Type-1/RPN query.
Specifies a filename that includes CCL to RPN conversion for this backend server. See Section 1.2.2, “CCL Qualifiers”. If given, the backend server will only "see" a Type-1/RPN query.
Specifies the stylesheet reference to be part of SRU HTTP responses when the client does not specify one. If none is given, then if the client does not specify one, then no stylesheet reference is part of the SRU HTTP response.
If specified, a conversion from the character set given to UTF-8 is performed by the generic frontend server. It is only executed for Z39.50 search requests (SRU/Solr are assumed to be UTF-8 encoded already).
Specifies a path for local file access using HTTP. All URLs with
a leading prefix (/ excluded) that matches the value of
are used for file access. For example, if the server is to offer
access in directory
xsl, the docpath would be
xsl and all URLs of the form
http://host/xsl will result in a local file access.
Specifies SRW/SRU ZeeRex content for this server. Copied verbatim to the client. As things are now, some of the Explain content seem redundant because host information, etc. is also stored elsewhere.
Specifies maximum record size/message size, in bytes. This
value also serves as the maximum size of incoming
packages (for Record Updates etc). It's the same value as that
given by the
Enables the retrieval facility to support conversions and specifications of record formats/types. See Section 6, “Retrieval Facility” for more information.
The XML below configures a server that accepts connections from
two ports, TCP/IP port 9900 and a local UNIX file socket.
We name the TCP/IP server
public and the
<yazgfs> <listen id="public">tcp:@:9900</listen> <listen id="internal">unix:/var/tmp/socket</listen> <server id="server1"> <host>server1.mydomain</host> <directory>/var/www/s1</directory> <config>config.cfg</config> </server> <server id="server2" listenref="public,internal"> <host>server2.mydomain</host> <directory>/var/www/s2</directory> <config>config.cfg</config> <cql2rpn>../etc/pqf.properties</cql2rpn> <explain xmlns="http://explain.z3950.org/dtd/2.0/"> <serverInfo> <host>server2.mydomain</host> <port>9900</port> <database>a</database> </serverInfo> </explain> </server> <server id="server3" listenref="internal"> <directory>/var/www/s3</directory> <config>config.cfg</config> </server> </yazgfs>
There are three configured backend servers. The first two
can be reached by both listener addresses.
"server1" is reached by all (two) since no
listenref attribute is specified.
"server2" is reached by the two listeners specified.
In order to distinguish between the two, a virtual host has
been specified for each server in the
"server2" elements for CQL to RPN conversion
is supported and explain information has been added (a short one here
to keep the example small).
The third server,
"server3" can only be reached