Skip to content

IP bans ​

/dashboard/settings/ip-bans

IP bans block IP addresses and IP ranges from using the website. A banned visitor can't browse any page, sign in, upload files or use the API.

Pro feature

IP bans are available in Chevereto Pro. If CHEVERETO_ENABLE_IP_BANS is set to 0, IP bans are disabled. See Toggles.

How IP bans work ​

On every request, Chevereto checks the client IP address against all active bans. A ban is active if it has no expiration date or if its expiration date hasn't passed yet. When a ban matches:

RequestResponse
WebsiteThe ban message is shown, or the visitor is redirected if the message is a URL
APIHTTP 403 with a JSON body. Its title holds the ban message, if it isn't a URL

If the ban has no message, the visitor gets You have been forbidden to use this website.

Expired bans aren't removed. They stay listed until you delete them, and they stop matching once their expiration date passes.

WARNING

IP bans rely on detecting the real client IP address. If your website is behind a proxy or CDN that isn't configured to pass the client IP, all visitors may share the proxy IP address. Banning that address will block everyone.

Adding IP bans ​

Click on "Add" in the top bar to open the "Add IP ban" form.

You can also ban IP addresses from the content itself. Admins and managers get a "Ban" button next to:

  • The uploader IP address, in the "Info" tab of the file page.
  • The registration IP address, in the user account settings at /dashboard/user/<id>.

When the IP address is already banned, a "Banned" label shows instead.

An IP address can't be added if an active ban already matches it, including wildcard bans. If an expired ban exists for the same IP address, edit that ban instead of adding a new one.

Editing IP bans ​

Click on the IP address in the list to edit the ban. Click on "Delete" to remove it. Deleting a ban can't be undone.

IP ban values ​

IP address ​

The IP address or IP range to ban.

TypeAccepted
StringIPv4 and IPv6 addresses, with wildcards

Use the * wildcard to ban a range. A wildcard matches any characters, so the pattern must still be a valid IP address when each * is replaced with 0.

ValueBans
192.0.2.10Only 192.0.2.10
192.0.2.*192.0.2.0 to 192.0.2.255
192.0.*.*192.0.0.0 to 192.0.255.255
2001:db8::*IPv6 addresses starting 2001:db8::
192.0.*Not accepted: 192.0.0 isn't valid

WARNING

IP addresses are matched as text. A wildcard in the middle of an octet also matches longer values: 192.0.2.1* bans 192.0.2.1, 192.0.2.10 to 192.0.2.19 and 192.0.2.100 to 192.0.2.199. IPv6 bans only match the address as the server receives it, usually in compressed form.

Expiration date ​

The date when the IP ban expires. Leave it empty for a permanent ban.

TypeFormatOptional
DatetimeYYYY-MM-DD HH:MM:SSY

The date is read in the timezone of your account settings. New accounts start with the website default time zone.

Message ​

The message shown to the banned visitor. Use it to give the reason for the ban, or to send the visitor somewhere else.

TypeAcceptedOptional
StringPlain text or a URLY
ValueEffect
EmptyShows You have been forbidden to use this website.
TextShows the text. HTML tags are escaped and shown as text
http:// or https:// URLRedirects the visitor to the URL with a 301 redirect

Released under the Apache-2.0 License.