<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>matthieu.yiptong.ca &#187; http</title>
	<atom:link href="http://matthieu.yiptong.ca/tag/http/feed/" rel="self" type="application/rss+xml" />
	<link>http://matthieu.yiptong.ca</link>
	<description>Matthieu/ergosteur&#039;s new blog</description>
	<lastBuildDate>Fri, 10 Sep 2010 14:46:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Fixing WordPress comment IP detection</title>
		<link>http://matthieu.yiptong.ca/2009/07/06/fixing-wordpress-comment-ip-detection/</link>
		<comments>http://matthieu.yiptong.ca/2009/07/06/fixing-wordpress-comment-ip-detection/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 23:06:16 +0000</pubDate>
		<dc:creator>Matthieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[mod_proxy]]></category>
		<category><![CDATA[mod_rpaf]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://matthieu.yiptong.ca/?p=7</guid>
		<description><![CDATA[I currently have WordPress running in an OpenVZ container behind a lighttpd reverse proxy. Because of this, the source IP for all comments was being detected as 172.16.32.201 (my lighttpd proxy). The solution was found on the WordPress support forum.
All I needed to do was add

if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $list [...]]]></description>
			<content:encoded><![CDATA[<p>I currently have WordPress running in an <a href="http://wiki.openvz.org/Main_Page">OpenVZ </a>container behind a lighttpd reverse proxy. Because of this, the source IP for all comments was being detected as 172.16.32.201 (my <a href="http://www.lighttpd.net/">lighttpd</a> proxy). The <a href="http://wordpress.org/support/topic/200543">solution</a> was found on the WordPress support forum.</p>
<p>All I needed to do was add</p>
<blockquote>
<pre><code>if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
        $_SERVER['REMOTE_ADDR'] = $list[0];
  }</code></pre>
</blockquote>
<p>to wp-config.php. This bit checks if  HTTP_X_FORWARDED_FOR is set in the HTTP request, and if so, uses it for the REMOTE_ADDR.</p>
<p><strong>Update:</strong></p>
<p>I found a better way to do this, assuming that the backend server is running apache2. Just install <a href="http://stderr.net/apache/rpaf/">mod_rpaf</a>. On Debian:</p>
<blockquote><p><code>apt-get install libapache2-mod-rpaf</code></p></blockquote>
<p>Then edit /etc/apache2/mods-enabled/rpaf.conf and set your proxy IP. This also allows apache&#8217;s access.log to show the real client IP.</p>
<p>One minor bug (not sure if it&#8217;s because of this code or lighttpd or my network setup) is that all the proxied IPs are prefixed with ::ffff:. In any case it&#8217;s just a minor annoyance.</p>]]></content:encoded>
			<wfw:commentRss>http://matthieu.yiptong.ca/2009/07/06/fixing-wordpress-comment-ip-detection/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
