yireo / magento2-salesblock2-by-ip
Block transactions based on IP matching
Package info
github.com/yireo/Yireo_SalesBlock2ByIp
Type:magento2-module
pkg:composer/yireo/magento2-salesblock2-by-ip
Requires
- php: >=8.2 <8.6
- ext-pcre: *
- magento/framework: ^101.0|^102.0|^103.0
- wikimedia/ip-utils: ^4.0.1 || ^5.0
- yireo/magento2-salesblock2: ^2.2
Requires (Dev)
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-29 21:01:49 UTC
README
This module is a helper-module for the Yireo_SalesBlock2 extension, that allows you to block orders from being placed, based on specific rules defined in the Magento Admin Panel.
This specific module allows you to match by a specific IP pattern. The following patterns are supported:
192.168.1.1or2001:db8::1= Direct IP matches (IPv4 and IPv6, in any notation)192.168.1.0/24or2001:db8::/32= IP ranges in CIDR notation192.168.1.1 - 192.168.1.10= Explicit IP ranges*= Every visitor
Multiple patterns can be separated by a newline, ,, ; or |.
Be careful with *: a rule with this pattern blocks orders from every visitor of the store. Partial wildcards like 192.168.1.* are not supported. Use a CIDR range like 192.168.1.0/24 instead. Invalid patterns (like 192.168.1.*, 192.168.1.0/33 or a reversed range like 192.168.1.10 - 192.168.1.1) are rejected when saving a rule. Invalid patterns that were saved with an older version are skipped and never match.
Installation
To install this module, use the following commands. First, install this module using composer. Note that this step will fail if the Yireo_SalesBlock2 is not installed yet.
composer require yireo/magento2-salesblock2-by-ip
Once this module is installed via composer, you can enable it:
./bin/magento module:enable Yireo_SalesBlock2ByIp
There are no further steps to take. The Yireo_SalesBlock2 module automatically picks up on things.
Client IP detection and reverse proxies
This module reads the client IP from REMOTE_ADDR only. The X-Forwarded-For header can be set to any value by a client, so it is ignored by default, even when Magento core is configured to use it (Magento core uses the leftmost IP of that header, which a blocked visitor could fake to get past an IP rule).
When Magento runs behind a reverse proxy (load balancer, CDN, Varnish), add the IP addresses of your proxies to the setting Trusted proxies under Stores > Configuration > Yireo > Yireo SalesBlock. When a request comes from a trusted proxy, the rightmost IP in the X-Forwarded-For header that is not a trusted proxy is used as the client IP. This setting is shared with Yireo_SalesBlock2ByGeo.