Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx Proxy Pass Not Giving Real IP #10

Open
aminhusni opened this issue Feb 8, 2019 · 2 comments
Open

Nginx Proxy Pass Not Giving Real IP #10

aminhusni opened this issue Feb 8, 2019 · 2 comments
Labels

Comments

@aminhusni
Copy link

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.

@aminhusni
Copy link
Author

aminhusni commented Feb 8, 2019

Remote IP Address with Go

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.

@faryon93
Copy link
Owner

faryon93 commented Feb 9, 2019

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

@faryon93 faryon93 added the bug label Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants