Download the PHP package blackcube/yii-proxy-middleware without Composer
On this page you can find all versions of the php package blackcube/yii-proxy-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blackcube/yii-proxy-middleware
More information about blackcube/yii-proxy-middleware
Files in blackcube/yii-proxy-middleware
Package yii-proxy-middleware
Short Description Yiisoft TrustedHostsNetworkResolver fork with CIDR support in withTrustedIps()
License BSD-3-Clause
Homepage https://github.com/blackcubeio/yii-proxy-middleware
Informations about the package yii-proxy-middleware
Blackcube Yii Proxy Middleware
Fork of Yiisoft\ProxyMiddleware\TrustedHostsNetworkResolver with CIDR range support added to withTrustedIps().
Installation
Why this fork?
The upstream TrustedHostsNetworkResolver::withTrustedIps() rejects any entry that is not a plain IP — even though its own matching engine (Yiisoft\NetworkUtilities\IpRanges) already supports CIDR.
| Entry | Upstream | This fork |
|---|---|---|
192.168.1.1 |
accepted | accepted |
10.0.0.0/8 |
rejected | accepted |
2001:db8::/32 |
rejected | accepted |
10.0.0.0/33 |
rejected | rejected |
not-an-ip |
rejected | rejected |
Every internal state field in the upstream class is private, so clean extension is not possible — the class is duplicated and withTrustedIps() is the only behavioural change.
Usage
All other methods (withForwardedHeaderGroups(), withTypicalForwardedHeaders(), withConnectionChainItemsAttribute(), process()) behave identically to the upstream — see the upstream docs for details.
Validation rules
withTrustedIps() throws InvalidArgumentException when:
- an entry is not a non-empty string
- an entry contains
/but is not a valid CIDR (invalid prefix, malformed IP) - an entry has no
/and is not a valid IPv4/IPv6 address
Credits
Forked from yiisoft/proxy-middleware (© Yii Software, BSD 3-Clause). All credit for the original TrustedHostsNetworkResolver goes to the Yiisoft contributors.
License
BSD 3-Clause — see LICENSE.md for the full license text, including the upstream copyright notice.