Skip to content

Commit

Permalink
Warn about client IP spoofing
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouke committed Mar 15, 2017
1 parent d653b5d commit 2684906
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ documentation on `installing GeoIP`_.
.. _installing GeoIP:
https://docs.djangoproject.com/en/1.6/ref/contrib/gis/geoip/

IP Data Accuracy
----------------
IP when behind a proxy
----------------------
If you're running Django behind a proxy like nginx, you will have to set
the `REMOTE_ADDR` META header manually using a middleware, to stop it from
always returning the ip of the proxy (e.g. 127.0.0.1 in many cases).
Expand All @@ -33,4 +33,6 @@ Which simply does this for each request:

``request.META['REMOTE_ADDR'] = request.META['HTTP_X_FORWARDED_FOR'].split(',')[0].strip()``

Your particular configuration may vary, X-Forwarded-For is not always accurate in some cases.
Your particular configuration may vary, `X-Forwarded-For` must be set by
a proxy that you have control over, otherwise it might be spoofed by the
client.

0 comments on commit 2684906

Please sign in to comment.