rejetto forum

Get real ip address using CloudFlare

0 Members and 1 Guest are viewing this topic.

Offline ihhoorr

  • Occasional poster
  • *
    • Posts: 2
    • View Profile
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
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
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

  • Tireless poster
  • ****
    • Posts: 842
  • Status: On hiatus (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
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 in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 910
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
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....


Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing