Page MenuHomePhabricator

X-FORWARDED-FOR related documentation patch
Closed, ResolvedPublic


Author: loic

Although running mediawiki behind a reverse proxy is common, it is suprisingly
difficult to figure out how to have mediawiki honor the X-FORWARDED-FOR header,
and the solution is somewhat counter-intuitive (i.e. adding the IP of the proxy
to SquidServers). Hopefully this small documentation patch will allow people
looking for the keywords related to the problem to find the proper solution.
When loooking in the mediawiki web site at the moment, there is no match for

Index: DefaultSettings.php

  • DefaultSettings.php (revision 22142)

+++ DefaultSettings.php (working copy)
@@ -1230,7 +1230,11 @@


    • A list of proxy servers (ips if possible) to purge on changes don't specify
  • * ports here (80 is default)

+ * ports here (80 is default). When mediawiki is running behind a proxy, its
+ * address should be listed in $wgSquidServers otherwise mediawiki won't rely
+ * on the X-FORWARDED-FOR header to determine the user IP address and
+ * all users will appear to come from the proxy IP address. Don't use domain
+ * names here, only IP adresses.

  1. $wgSquidServers = array(''); $wgSquidServers = array();

Version: 1.10.x
Severity: normal
OS: Linux
Platform: PC



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:40 PM
bzimport set Reference to bz9896.
bzimport added a subscriber: Unknown Object (MLST).

loic wrote:

Patch to DefaultSettings.php for documentation purpose.


It seems to say that it's best if the proxy servers be listed as IPs, and then that they _must_ be listed as IPs. Could this be clarified?

robchur wrote:

Further clarified documentation in 25880.