Open aminhusni opened 5 years ago
Within the golang net.Request structure there is a RemoteAddr attribute, which unsurprisingly contains the remote address of the requester. Job done, right? Well not really if you use any form of reverse proxy or load balancer for your application, which we do. This will always appear to the go server as if every request is coming from the load balancer, which would be terrible if you wanted to use this as a throttling metric of any kind. So, we can immediately throw this out as non-useful for our purposes, unless you have one go server running not behind any form of reverse proxy.
Hi Amin, Thank you for reporting this issue.
You are right: The current NGINX configuration does not forward the real client IP.
I saw you submitted a PR which changes the NGINX configuration that the X-Forwarded-For
header is passed to hlswatch.
In my opinion this is the only way to achieve proper client IPs behind a reverse proxy.
I want to discuss some points before merging your PR. See #11
Kind regards, Maxi
I am trying to stream from two IP address but it is not accurate. I think what happened was that when I get the m3u8 file from Nginx and Nginx reverse proxy, the hlswatch is reading the IP address as localhost or from where the Nginx is querying from instead of the actual client/end-user that is requesting for the m3u8 file.
Can't confirm this as I can't really debug golang.