Address connection filter

This filter allows you to accept or reject connections based on the client's IP address.

Parameter: Addresses allowed

Optional. A space-separated list of Java regular expressions for IP addresses that are allowed to connect.

Keep in mind that in Java regular expressions, a dot means any character, so if you mean to specify a dot, it must be escaped with a backslash.

If this is specified, and the client address does not match any of the regular expressions, the connection will be rejected.


127\.0\.0\.1 133\.24\..* either or any IP4 address that starts with 133.24.

750f:17a0:6770:6930:15c:[0-9a-f]{3,4}:d6cc any IP6 address that starts with 750f:17a0:6770:6930:15c: and ends with :d6cc, with 3 or 4 digits in between

Parameter: Addresses denied

Optional. Like the previous parameter, but if the client address matches any of these regular expressions, the connection will be rejected.

Parameter: Denied message

Optional. If specified, this message will be sent to the client (this is applicable to Postgres and MySQL, other databases may or may not send back a message).

Parameter: Execute code

If true, then in addition to the regular processing done by this filter, the JavaScript code (if any) in this filter will be invoked before the result is returned to the engine.

This gives you an opportunity to have more fine-grained control over the exact behavior of the filter.

The following variables will be accessible from your code, in the context object:

clientIP will always be the client's IP address, which can be IP4 (e.g. or IP6 (e.g. 2600:1201:6c70:39f1:47c:d4cc:5d5e:1af0)

socket will be a Java socket object

result is the result object

Example code

A (slightly contrived) example that checks if the last number of an IP4 address is 200 or more:

const lastDotIdx = context.clientIP.lastIndexOf(".");
if (lastDotIdx > 0) {
const finalNumStr = clientAddress.substring(lastDotIdx + 1);
const finalNum = parseInt(finalNumStr);
if (finalNum >== 200) {
context.result.success = false;
context.result.errorMessage = "No IPs ending of 200 and over";