3. An example configuration
Prev | Chapter 6. Configuration: the Metaproxy configuration file format | Next

## 3. An example configuration

The following is a small, but complete, Metaproxy configuration file (included in the distribution as `metaproxy/etc/config1.xml`). This file defines a very simple configuration that simply proxies to whatever back-end server the client requests, but logs each request and response. This can be useful for debugging complex client-server dialogues.

    <?xml version="1.0"?>
    <metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
      <dlpath>/usr/lib/metaproxy/modules</dlpath>
      <start route="start"/>
      <filters>
        <filter id="frontend" type="frontend_net">
          <port>@:9000</port>
        </filter>
        <filter id="backend" type="z3950_client">
        </filter>
      </filters>
      <routes>
        <route id="start">
          <filter refid="frontend"/>
          <filter type="log"/>
          <filter refid="backend"/>
          <filter type="bounce"/>
        </route>
      </routes>
    </metaproxy>

It works by defining a single route, called `start`, which consists of a sequence of four filters. The first and last of these are included by reference: their `<filter>` elements have `refid` attributes that refer to filters defined within the prior `<filters>` section. The middle filter is included inline in the route.

The four filters in the route are as follows: first, a `frontend_net` filter accepts Z39.50 requests from any host on port 9000; then these requests are passed through a `log` filter that emits a message for each request; they are then fed into a `z3950_client` filter, which forwards all Z39.50 requests to the client-specified back-end Z39.50 server. Those Z39.50 packages are returned by the `z3950_client` filter, with the response data filled by the external Z39.50 server targeted. All non-Z39.50 packages are passed through to the `bounce` filter, which definitely bounces everything, including fish, bananas, cold pyjamas, mutton, beef and trout packages. When the response arrives, it is handed back to the `log` filter, which emits another message; and then to the `frontend_net` filter, which returns the response to the client.

### 3.1. Other configuration examples

A collection of Metaproxy configuration examples are included in the distribution at `metaproxy/etc/config*.xml`

Prev | Up | Next
2. Overview of the config file XML structure | Home | 4. Config file modularity