Manual:Hooks/IsTrustedProxy
From Linux Web Expert
IsTrustedProxy | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> Allows an extension to set an IP as trusted or not. | |
<translate> Define function:</translate> | public static function onIsTrustedProxy( $ip, $trusted ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"IsTrustedProxy": "MediaWiki\\Extension\\MyExtension\\Hooks::onIsTrustedProxy"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> ProxyLookup.php |
<translate> Interface:</translate> | IsTrustedProxyHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:IsTrustedProxy extensions</tvar>.</translate>
Details
- $ip - The IP address of the proxy.
- $trusted - A bool indicating the IP is or isn't trusted.
Modifies the behavior of ProxyLookup::isTrustedProxy
; this is more or less the dynamic equivalent of setting $wgCdnServers . It mainly means that when a request coming from this IP tells (via the X-Forwarded-For
header) that the real source of the request is some other IP, MediaWiki will trust that claim.