Install

Works with Drupal: ^11.3 || ^12

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 47.37 KB
MD5: 1724ba82fa0dcc4417dfaa1380fa0e38
SHA-1: d845e3b8d169f5addfa0bdee2127947aa39ee79a
SHA-256: 6bf3c901988910fbfb9190080d78c3bc4ceccd189933b14b7eca00013c597c40
Download zip 83.69 KB
MD5: 833209822e1041d043395a448244770c
SHA-1: 96268e37e57e445fd0c4284022563ec9fb5b351e
SHA-256: 52571919b671d6a1ed5f19b49ea27d348ec04bf8addc9637dc404923d0bb662f

Release notes

First beta of the 9.x branch, a major refresh of the module for Drupal ^11.3 and 12.

Warning!

If your site is behind a reverse proxy, CDN or other middleware which adds to the X_FORWARDED_FOR header or others like it, you must configure your reverse proxy settings in settings.php or the 9.x version of this module will block all traffic instead .

Highlights since 8.x-4.0-beta4:

  • Denied logins now fail on the login form itself with a configurable message, instead of signing the user in and straight back out. Users signed out mid-session by an IP change get a message and land on a configurable page, which is now validated so it can't point off-site or at a broken path.
  • Per-user allowed ranges live on the user account instead of configuration and are edited on the user form.
  • Ranges are entered one per line instead of separated by semicolons.
  • Role restrictions can either remove the role for the request or end the session, and users are told when it happens.
  • New drush commands for locked-out administrators: restrict_by_ip:status reports what is configured and whether an IP may log in, and restrict_by_ip:allow adds an allowed range from the shell.
  • Other modules can alter the allowed ranges before they apply, for example to pull them from settings.php or an external service; see restrict_by_ip.api.php.
  • The client IP is resolved through Drupal core's request handling and honors the reverse_proxy settings, and a new help topic covers configuration, proxies, and lockout recovery.

Upgrading from 8.x-4.x: run database updates; semicolon-separated ranges and existing per-user restrictions are migrated automatically. If the site sits behind a reverse proxy or CDN, check the IP detection page afterwards to confirm the right client address is seen.

Under the hood the codebase is fully typed and analyzed at phpstan level 6, and the test suite runs in half the time. Please put the beta through its paces and report anything odd in the issue queue; a stable 9.0.0 will follow once it has had some real-world use.

Contributors (24)

darvanen, DrupalBDGirl, alex.bukach, amairesse, anybody, bartclarkson, bburg, eanushan, haza, kleinmp, kristen pol, loopduplicate, mcdruid, mfb, nikolay shapovalov, nubeli, relaxy, rex.barkdoll, rocketeerbkw, rviner, sheise, stijnstroobants, wrd

Changelog

Issues: 17 issues resolved.

Changes since 8.x-4.0-beta4 (compare):

Bug

  • #2935827: Don't run the login-denied log message through t()
  • fix: #3274832 User role is not selected on the edit page after restrcting roles by IP
  • Automated Project Update Bot fixes from run 12-864040.
  • fix: #3394774 Circular reference detected for service "restrict_by_ip.current_user"

Feature

  • feat: #2315009 Use textareas and allow "one IP per line"
  • feat: #2825927 Restrict Role by IP - Deny Access
  • #3582618: Display messages when IP restriction removes roles or denies login
  • feat: #3283846 Store per user IP range in database instead of config
  • feat: #3419590 Option for including a IP Database
  • feat: #415908 Include error message in form_set_error instead
  • feat: #2092153 Drush integration
  • feat: #3082413 Improve in-page help/docs

Misc

  • Automated Project Update Bot fixes from run 12-884047.

Task

  • task: #2602664 Use Drupal API / Symfony to retrieve the users IP
  • task: #3614479 Non-functional upgrades
  • task: #3614483 Error page validation
  • task: #3614487 Trim test suite
Created by: darvanen
Created on: 3 Aug 2026 at 12:29 UTC
Last updated: 3 Aug 2026 at 12:52 UTC
Bug fixes
New features

Other releases