Author Topic: Get real ip address using CloudFlare  (Read 1776 times)

0 Members and 1 Guest are viewing this topic.

Offline ihhoorr

  • Occasional poster
  • *
  • Posts: 2
    • View Profile
Get real ip address using CloudFlare
« on: February 06, 2016, 08:08:52 PM »
How can I get the real ip address from the user, when using CloudFlares service?

I need the real ip for the user connecting


Document : https://support.cloudflare.com/hc/en-us/sections/200805497-Restoring-Visitor-IPs

Offline rejetto

  • Administrator
  • Insane programmer
  • *
  • Posts: 12832
  • Country: it
    • View Profile
Re: Get real ip address using CloudFlare
« Reply #1 on: February 08, 2016, 05:33:54 AM »
Consider i DON'T know this cloudflare.
From what i can read from the documentation, they support the "X-Forwarded-For" field, and so does HFS.
For security reasons HFS by default accepts this field only if coming from the same computer (127.0.0.1).
THEN: if cloudflare works locally on your computer, then it should automatically work with HFS.
If cloudflare service is connecting to your computer over the net, then it is not working and you need to do this:
1. menu > save options > to file
you now have a hfs.ini file
2. edit hfs.ini and search for the line starting with "forwarded-mask="
3. now you should add the allowed addresses, all separated by semicolon ";" like
forwarded-mask=127.0.0.1;192.168.3.*;192.168.5.*
this last part is slightly complicated because you may not know what addresses to add.
My advice is to start with
forwarded-mask=127.0.0.1;*
just for testing. This should work, but it's very unsecure, so DON'T KEEP IT for long.
If this doesn't work it's useless to go on, as it should give permission to ALL addresses.
If it is working, then you should enter all the addresses to allow.
I guess, from the documentation, that these addressess are listed at https://support.cloudflare.com/hc/en-us/articles/200170826-How-do-I-restore-original-visitor-IP-with-Lighttpd-
but the syntax is not the same used by HFS.
If you are not an expert and don't know how to do, you can make it simple by replacing all those addresses like in this example:
This address 199.27.128.0/21
will become 199.27.*
i just removed last 3 numbers, as you can see.
Do the same with the others, and remember to separated them with ;
you have to manually edit HFS options to

Offline LeoNeeson

  • Insane poster
  • *****
  • Posts: 402
  • Country: uy
  • Solitario...
    • View Profile
    • twitter.com/LeoNeeson
Re: Get real ip address using CloudFlare
« Reply #2 on: February 09, 2016, 12:23:45 AM »
As far I know, CloudFlare is some kind of "layer", between your server and a domain. Unless you are running HFS on a VPS, and that VPS has Cloudflare enabled as external IP (or something similar), I find your configuration hard to understand. ihhoorr: Can you give us more details?...
• HFS ahora también disponible en Español! (Clic aqui) :)
• HFS is now also available in Spanish! (Click here)

Offline bmartino1

  • Insane poster
  • *****
  • Posts: 712
  • Country: us
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: Get real ip address using CloudFlare
« Reply #3 on: February 09, 2016, 09:44:26 AM »
https://www.cloudflare.com/features-cdn/?gclid=CjwKEAiAuea1BRCbn-2n7PbLgEMSJAABQvTTqVM1itxM1RAj3j57-1xjaQVgf4Ju0T-j3KqePYD76xoCOjXw_wcB

it local ran dns client program, your paying to much for a silly product...

since it on your machine, its your public IP

http://www.ipchicken.com/
Shows your public IP

the program run on your computer takes that public ip that you use for the internet and makes it a DNS name....

ITs just NAT and DNS....


I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1