frontend_net — Metaproxy Network Server module that accepts Z39.50 and HTTP requests
This is a frontend module. Listens on one or more ports and sends HTTP/Z39.50 messages to other filters.
Element port
is a repeating element (1 or more). The
text content specifies a listening port. A few attributes may be
given for each port element. Attribute route
specifies
the route to use for the port. Attribute max_recv_bytes
specifies maximum package size that YAZ should accept (it calls
cs_set_max_recv_bytes function of YAZ).
Element threads
is an optional element. The
text content specifies the number of worker threads for the following
filters to use. The default value is 5 (5 worker threads).
Element max-threads
is an optional element. The
text content specifies maximum number of worker threads for the following
filters to use. By default the thread count is fixed.
By using this setting with a higher value than the threads
setting, extra worker threads will be added as necessary.
Element stack-size
is an optional element. The
text content specifies stack size in kilobytes for worker threads.
If omitted, the system default stack size for threads is used.
Element timeout
is an optional repeatable element. The
text content is treated as an integer that specifies the session timeout
in seconds for a client session (using the frontend net filter). The
default value is 300 (5 minutes). The element may be repeated and an IP
pattern may be given for each element.
Element connect-max
is an optional repeatable element.
The text content is treated as an integer that specifies the maximum number
of accepted TCP sessions from the same IP within a minute. A value of 0
will not allow any connections. The attribute ip
specifies an IP address pattern. If the IP pattern is matched, the limit
takes effect. The elements are inspected in the order they appear and
processing stops at first element with a pattern that matches the IP.
If no element matches, no limit takes place, which is same behavior as if
no elements are specified. The IP pattern is a glob pattern.
Blanks in a pattern may be used to provide alternatives.
For example:
ip="::1 127*"
would match ::1
or
127.0.0.1
, but not 128.0.0.1
.
In this example the 100 connections are allowed from localhost.
No connections are allowed from 1.2.3.4
.
10 connections are allowed from every other address.
<connect-max ip="127.0.0.1">100</connect-max> <connect-max ip="1.2.3.4">0</connect-max> <connect-max>10</connect-max>
Element connect-total
is an optional repeatable element.
The text content is treated as an integer that specifies the maximum number
of TCP sessions from the same IP. Otherwise similar to
connect-max
.
Element http-req-max
is an optional repeatable element.
The text content is treated as an integer that specifies maximum number
of accepted HTTP requests from the same original IP within a minute.
Otherwise similar to connect-max
.
Element message
is an optional element. If
given and non-empty, logging is performed by the frontend_net filter
(to the log file as given by option -l).
Element stat-req
is an optional element. It
specifies a URL path that triggers a report to be generated by
the frontend_net filter. By default this report is disabled (same
as empty value). The value itself is the path and should be prefixed
with a slash. For example /fn_stat
.
# Metaproxy XML config file schemas
#
# Copyright (C) Index Data
# See the LICENSE file for details.
namespace mp = "http://indexdata.com/metaproxy"
filter_frontend_net =
attribute type { "frontend_net" },
attribute id { xsd:NCName }?,
attribute name { xsd:NCName }?,
element mp:threads { xsd:integer }?,
element mp:max-threads { xsd:integer }?,
element mp:stack-size { xsd:integer }?,
element mp:port {
attribute route { xsd:NCName }?,
attribute max_recv_bytes { xsd:integer }?,
attribute port { xsd:integer }?,
attribute cert_fname { xsd:string }?,
xsd:string
}+,
element mp:timeout {
attribute ip { xsd:string }?,
attribute verbose { xsd:integer }?,
xsd:integer
}*,
element mp:connect-max {
attribute ip { xsd:string }?,
attribute verbose { xsd:integer }?,
xsd:integer
}*,
element mp:connect-total {
attribute ip { xsd:string }?,
attribute verbose { xsd:integer }?,
xsd:integer
}*,
element mp:http-req-max {
attribute ip { xsd:string }?,
attribute verbose { xsd:integer }?,
xsd:integer
}*,
element mp:message { xsd:string }?,
element mp:stat-req { xsd:string }?
A typical configuration looks like this:
<filter type="frontend_net"> <threads>10</threads> <port>@:9000</port> <connect-max>100</connect-max> <!-- allow many HTTP requests from localhost --> <http-req-max ip="::1 127.*">10000</http-req-max> <!-- fewer for outsiders --> <http-req-max>100</http-req-max> <message>FN</message> <stat-req>/fn_stat</stat-req> </filter>