< Manual:Hooks
IsTrustedProxy
Available from version 1.9.0
Allows an extension to set an IP as trusted or not.
Define function:
public static function onIsTrustedProxy( $ip, $trusted ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"IsTrustedProxy": "MyExtensionHooks::onIsTrustedProxy"
	}
}
Called from: File(s): ProxyLookup.php
Interface: IsTrustedProxyHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:IsTrustedProxy extensions.

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 $wgSquidServers/$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.

This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.