Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -36,6 +36,8 @@ |
37 | 37 | * Most presentational html attributes like valign are now converted to inline |
38 | 38 | css style rules. These attributes were removed from html5 and so we clean them up |
39 | 39 | when $wgHtml5 is enabled. This can be disabled using $wgCleanupPresentationalAttributes. |
| 40 | +* When MediaWiki is being run behind a proxy, the X-Real-IP header is now also checked |
| 41 | + to determine the client's actual IP address. |
40 | 42 | |
41 | 43 | === Bug fixes in 1.19 === |
42 | 44 | * $wgUploadNavigationUrl should be used for file redlinks if |
Index: trunk/phase3/includes/ProxyTools.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Extracts the XFF string from the request header |
11 | | - * Checks first for "X-Forwarded-For", then "Client-ip" |
| 11 | + * Checks first for "X-Forwarded-For", then "Client-ip", then "X-Real-IP" |
12 | 12 | * Note: headers are spoofable |
13 | 13 | * @return string |
14 | 14 | */ |
— | — | @@ -21,11 +21,13 @@ |
22 | 22 | } |
23 | 23 | $index = strtoupper ( 'X-Forwarded-For' ); |
24 | 24 | $index2 = strtoupper ( 'Client-ip' ); |
| 25 | + $index3 = strtoupper ( 'X-Real-IP' ); |
25 | 26 | } else { |
26 | 27 | // Subject to spoofing with headers like X_Forwarded_For |
27 | 28 | $set = $_SERVER; |
28 | 29 | $index = 'HTTP_X_FORWARDED_FOR'; |
29 | 30 | $index2 = 'CLIENT-IP'; |
| 31 | + $index3 = 'HTTP_X_REAL_IP'; |
30 | 32 | } |
31 | 33 | |
32 | 34 | #Try a couple of headers |
— | — | @@ -33,6 +35,8 @@ |
34 | 36 | return $set[$index]; |
35 | 37 | } elseif( isset( $set[$index2] ) ) { |
36 | 38 | return $set[$index2]; |
| 39 | + } elseif( isset( $set[$index3] ) ) { |
| 40 | + return $set[$index3]; |
37 | 41 | } else { |
38 | 42 | return null; |
39 | 43 | } |