1
HFS ~ HTTP File Server / Re: Question about passing the original IP address through to the HFS logs
« on: December 16, 2020, 01:59:44 AM »
I currently use an nginx reverse proxy and can pass the connecting ip. I tried this with Apache and was never successful.
As a side note, HFS is always going to show the connection coming from the proxy IP address, but in HFS you can turn off logging of that connection and instead record the IP of the GET requests, which is what nginx passes and likely the address your interested in.
An added bonus to using a reverse proxy is it can easily be setup to use free Letsencrypt SSL certs and the HFS server can remain standard HTTP.
Here's what you need nginx to pass in a custom header:
X-REAL-IP - $remote_addr
X-Forwarded-For $remote_addr
Host $host
X-Forwarded-Proto $scheme
As a side note, HFS is always going to show the connection coming from the proxy IP address, but in HFS you can turn off logging of that connection and instead record the IP of the GET requests, which is what nginx passes and likely the address your interested in.
An added bonus to using a reverse proxy is it can easily be setup to use free Letsencrypt SSL certs and the HFS server can remain standard HTTP.
Here's what you need nginx to pass in a custom header:
X-REAL-IP - $remote_addr
X-Forwarded-For $remote_addr
Host $host
X-Forwarded-Proto $scheme