For geolocation and other purposes, your project may need to get hold of the remote IP address - typically with request.META['REMOTE_ADDR'].

Our cloud sites are behind a load-balancer. The load-balancer refers the request to your Django server, which means that your Django programs will see visitors apparently on private 10.x.x.x addresses instead.

However, the load-balancer will forward the client IP address, under different headers:

  • for CloudFlare-enabled sites: request.META['HTTP_CF_CONNECTING_IP']
  • for other sites: request.META['HTTP_X_FORWARDED_FOR']
Did this answer your question?