rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: gogi1000 on July 10, 2022, 11:30:47 AM

Title: problem with get ip address of external user in my log
Post by: gogi1000 on July 10, 2022, 11:30:47 AM
i have a the hfs server in the dmz zone. my hfs have a public ip address. when the user downloads file from the my hfs server in log it displays ip 127.0.0.1 how i can receive public ip address of  the user? the format of log is in the apache format %u %f "%r" %>s %b
Title: Re: problem with get ip address of external user in my log
Post by: rejetto on July 14, 2022, 08:22:02 AM
HFS can display real address of the user in these cases
1) user directly connects to hfs (probably not an option for you)
2) you use NAT on your router. All configuration is to be done on your router, not on HFS
3) you use an http proxy (a generic proxy will hide the address). In this case if the proxy runs on the same computer you need no configuration on HFS. If it runs on another computer you have to configure manually as described at http://rejetto.com/forum/index.php?topic=6292.0

If you are using a generic proxy you have no way to receive external address.
If you are using FRP as proxy, it can be configured as http proxy and/or generic proxy.
Title: Re: problem with get ip address of external user in my log
Post by: gogi1000 on July 14, 2022, 10:43:41 AM
My hfs server is behind the hardware firewall. the hfs server has the static public ip address? what i do? how configure firewall that my hfs receive the public ip of users?
Title: Re: problem with get ip address of external user in my log
Post by: rejetto on July 14, 2022, 04:12:58 PM
it depends on the firewall, and i don't know your firewall
Title: Re: problem with get ip address of external user in my log
Post by: LeoNeeson on July 15, 2022, 06:00:36 AM
@gogi1000: May I ask you some questions?

1) Is the external IP address (of users who download files) shown if you use the Apache server?

2) Are you running Apache along with HFS? (are you running both servers at the same time?)

3) What operating system are you using?

4) What is the exact brand and model of your router? (or hardware firewall)

If you answer the following questions, it would be much easier to help you (and perhaps we could find more info on how to configure your system).
Title: Re: problem with get ip address of external user in my log
Post by: gogi1000 on July 28, 2022, 01:06:14 PM
Title: Re: problem with get ip address of external user in my log
Post by: LeoNeeson on July 30, 2022, 01:46:48 PM
If 'the IP address is not shown in the Apache server', then this issue could be related to your Cisco router, and HFS can't do anything to solve this. You could try to describe this problem (and ask for help), on the Cisco Community forum (https://community.cisco.com/t5/networking/ct-p/4461-network-infrastructure). Since HFS is not widely known, when describing your issue, my recommendation is only saying that you are using an 'Apache server'. I'm almost sure there must be some configuration on your router that is causing this. If you solve this, you could comment the solution here, as reference for other users, in case someone comes with a similar issue in the future. :)
Title: Re: problem with get ip address of external user in my log
Post by: rejetto on August 01, 2022, 12:05:43 PM
so, you are using apache as reverse proxy in front of hfs ?
if yes, you are on case #3 of my list
Title: Re: problem with get ip address of external user in my log
Post by: bmartino1 on August 11, 2022, 03:44:26 PM
i have a the hfs server in the dmz zone. my hfs have a public ip address. when the user downloads file from the my hfs server in log it displays ip 127.0.0.1 how i can receive public ip address of  the user? the format of log is in the apache format %u %f "%r" %>s %b

Sounds like you're using a patch she has reverse proxy. Because it's reverse proxy you'll always see the traffic coming on your local Host Network. Because that's what a proxy does. In that case you need to look into the logging on Apache when they first hit your Apache website that does the reverse proxy.

Otherwise you need a port forward your HFS to the public and use HFS as your main website.

See Apache docs:
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html

Title: Re: problem with get ip address of external user in my log
Post by: rejetto on August 11, 2022, 04:08:32 PM
if apache/nginx works as reverse-proxy, it forwards the client's ip to HFS
Title: Re: problem with get ip address of external user in my log
Post by: bmartino1 on August 11, 2022, 04:28:43 PM
1.hfs need to be set to receive an IP from any IP not set to local Host IP

2. Reverse proxy need to send traffic to the machine address not the localhost (this is why you are seeing 127.0.0.1)

Rejetto I have not found that to be the case, such as stunnel. The networking from stunnel is on the local Host and all connection are to and from the localhost. S tunnel logs the public ip. The work silent plz has done os to combine and see that log.

The same is still true with HFS in a reverse proxy situation as configuration by default. This is done to secure the connection with in the reverse proxy, that why jfs is seeing the connection as 127.0.0.1 as machine traffic forwarded it to that.

OP will need to revisit his Apache configuration to setup his networking to allow HFS to see that data.
Title: Re: problem with get ip address of external user in my log
Post by: rejetto on August 12, 2022, 02:46:28 PM
1. it's described in the link i posted
2. i suppose this to not affect the mechanism, as it address is carried inside the http request

stunnel is not an http proxy, as apache can be, and so you have no way to get the real ip.

with nginx (i'm not using apache) you only need a line like this:
         proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;

as an alternative, HFS 3 is already supporting https natively, one may not need a proxy.