<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How to Get a Client IP Address in DJANGO</title>
	<atom:link href="http://www.pressthered.com/how_to_get_a_client_ip_address_in_django/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pressthered.com/how_to_get_a_client_ip_address_in_django/</link>
	<description>Adventures in Software Development</description>
	<lastBuildDate>Fri, 03 Feb 2012 16:36:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Elf M. Sternberg</title>
		<link>http://www.pressthered.com/how_to_get_a_client_ip_address_in_django/comment-page-1/#comment-59318</link>
		<dc:creator>Elf M. Sternberg</dc:creator>
		<pubDate>Fri, 09 Dec 2011 22:32:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.pressthered.com/?p=563#comment-59318</guid>
		<description>The easiest way to get both is:

ip_address = request.META.get(&#039;HTTP_X_FORWARDED_FOR&#039;, &#039;&#039;) or request.META.get(&#039;REMOTE_ADDR&#039;)</description>
		<content:encoded><![CDATA[<p>The easiest way to get both is:</p>
<p>ip_address = request.META.get(&#8216;HTTP_X_FORWARDED_FOR&#8217;, &#8221;) or request.META.get(&#8216;REMOTE_ADDR&#8217;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elf M. Sternberg</title>
		<link>http://www.pressthered.com/how_to_get_a_client_ip_address_in_django/comment-page-1/#comment-59317</link>
		<dc:creator>Elf M. Sternberg</dc:creator>
		<pubDate>Fri, 09 Dec 2011 22:30:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.pressthered.com/?p=563#comment-59317</guid>
		<description>Um, no.

You&#039;re behind a proxy.  That&#039;s why you&#039;re getting these two different values.  If your site was completely fronted to the Internet and your instance of Apache or whatever was your contact point with your clients, then your REMOTE_ADDR would be correct.  In that case, HTTP_X_FORWARDED_FOR would be blank, because you had not been forwarded the request from a proxy.</description>
		<content:encoded><![CDATA[<p>Um, no.</p>
<p>You&#8217;re behind a proxy.  That&#8217;s why you&#8217;re getting these two different values.  If your site was completely fronted to the Internet and your instance of Apache or whatever was your contact point with your clients, then your REMOTE_ADDR would be correct.  In that case, HTTP_X_FORWARDED_FOR would be blank, because you had not been forwarded the request from a proxy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rafael</title>
		<link>http://www.pressthered.com/how_to_get_a_client_ip_address_in_django/comment-page-1/#comment-42326</link>
		<dc:creator>Rafael</dc:creator>
		<pubDate>Wed, 03 Aug 2011 17:26:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.pressthered.com/?p=563#comment-42326</guid>
		<description>The method HTTP_X_FORWARDED_FOR is using server, into localhost faul.

Exemple:

from django.http import HttpRequest  
   
def mypage(request):
    try:
        # case server 200.000.02.001
        client_address = request.META[&#039;HTTP_X_FORWARDED_FOR&#039;]
    except:
        # case localhost ou 127.0.0.1
        client_address = request.META[&#039;REMOTE_ADDR&#039;]</description>
		<content:encoded><![CDATA[<p>The method HTTP_X_FORWARDED_FOR is using server, into localhost faul.</p>
<p>Exemple:</p>
<p>from django.http import HttpRequest  </p>
<p>def mypage(request):<br />
    try:<br />
        # case server 200.000.02.001<br />
        client_address = request.META['HTTP_X_FORWARDED_FOR']<br />
    except:<br />
        # case localhost ou 127.0.0.1<br />
        client_address = request.META['REMOTE_ADDR']</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dylan</title>
		<link>http://www.pressthered.com/how_to_get_a_client_ip_address_in_django/comment-page-1/#comment-9713</link>
		<dc:creator>Dylan</dc:creator>
		<pubDate>Fri, 12 Feb 2010 14:47:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.pressthered.com/?p=563#comment-9713</guid>
		<description>Was getting the same with REMOTE_ADDR, but works perfectly with HTTP_X_FORWARDED_FOR in my Django apps. Thanks for that!</description>
		<content:encoded><![CDATA[<p>Was getting the same with REMOTE_ADDR, but works perfectly with HTTP_X_FORWARDED_FOR in my Django apps. Thanks for that!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

