mod_access lets you filter clients by IP address.

access.deny (action)

denies access by returning a 403 status code


access.check (action)

allows or denies access based on client IP address

access.check rules;
A key value list mapping "access" and/or "deny" keys to a list of CIDR addresses or "all".

Checks the client IP address agains the rules. Default is to deny all addresses. The most precise matching rule defines the result ("" takes precedence over ""; similar to routing tables); if the same CIDR is in both lists the second action is taken. "all" is a synonym for "" and "::/0", matching all IPv4 and IPv6 addresses.

Example: restrict access to local network

Limit access to clients from the local network. The deny rule isn't strictly required, as the default is to deny anyway. The smaller CIDR strings for the local networks override the global deny rule.

setup {
	module_load "mod_access";

access.check (
	"allow" => ("", "", "", ""),
	"deny" => ("all")

Example: restrict access to subnet with exception

Limit access to clients from "", but deny access to "". As "" (equivalent to "") is a more precise match it overwrites the allow rule for the subnet "" containing it.

setup {
	module_load "mod_access";

access.check (
	"allow" => (""),
	"deny" => ("")

access.redirect_url (option)

url to redirect to if access was denied (not implemented yet)

access.redirect_url url;
Default value: not set


access.log_blocked (option)

whether to log when access was denied (with log level "info")

access.log_blocked url;
Default value: false