This page is a translated version of the page Manual:$wgCdnServers and the translation is 27% complete.
Einstellungen für den HTTP-Proxy (CDN): $wgCdnServers
An array of individual proxy servers to help MediaWiki detect if the request has been proxied.
But also to send back to the proxy PURGE commands on changes.
Eingeführt in Version:1.34.0 (Gerrit change 387877; git #f9f8dff4)
Entfernt in Version:weiterhin vorhanden
Erlaubte Werte:nicht angegeben
Vor 1.4.0 war kein Standardwert gesetzt.


This variable is about telling MediaWiki what are the individual IP addresses of each Proxy servers that serve content to your visitors.

Du kannst auch explizit Port-Nummern angeben. However, if you specify port numbers, you need to add the same IP to $wgCdnServersNoPurge , otherwise the server will not be recognized as a configured proxy (known bug T132538).

If you are upgrading to a MediaWiki version prior to 1.35 you might now need to specify port 80 explicitly if you are using that port. E.g. myserver:80. Otherwise the port 1080 will be assumed. (https://phabricator.wikimedia.org/T291768)

Note that if you have CIDR ranges (e.g., make sure you set them in $wgCdnServersNoPurge instead.

The setting can be used in many Proxy setups, both within a private network or through an external provider, and also with external services that are based on either Varnish or Squid.

Konfigurationsbeispiel mit Varnish

Consider the following setup details:

  • one and/or more web servers ("origins") with MediaWiki running
  • Varnish configuration points to your MediaWiki origins
  • You have a few Varnish servers that proxies requests for the web servers

Here are the configurations you have to set in place:

  • In Varnish, set a X-Forwarded-For HTTP header with client.ip, example:
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
  • Create an array of servers. Ideally it should be IP in decimal format but those would work
// In LocalSettings.php
$wgUseCdn = true;
$wgCdnServers = array();
$wgCdnServers[] = "";
$wgCdnServers[] = "";
$wgCdnServers[] = "";
$wgCdnServers[] = "some.internal.name";  // Also works if you have a DNS configured on every MW origins. Es ist aber nicht empfohlen.
#$wgCdnServers[] = "";       // WON’T WORK, refer to $wgCdnServersNoPurge
The following IP are for example purpose, defined in from RFC 5737.

TODO: Insert example of a valid IPv6 address that is part of 2001:DB8::/32 range as per RFC3849

Verwendungshinweise und Geschichte

  • Specifying the port number of your proxy software is not necessary.

This will be useful when you don't run your proxy software at port 80 (used by default).

  • Any IPs listed in this array will be treated as trusted surrogates (reverse proxies)
  • IP addresses displayed for users connected via these Squid/Varnish servers therefore will match individual user IPs, not the Squid's IP.


  • Each entry can be either IPv6/IPv4 addresses in octal format (e.g.

Anything described in includes/utils/IP.php should be valid.

Siehe auch