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

@reserved is incorrect #10

Closed
OvermindDL1 opened this issue Mar 12, 2019 · 1 comment
Closed

@reserved is incorrect #10

OvermindDL1 opened this issue Mar 12, 2019 · 1 comment

Comments

@OvermindDL1
Copy link

OvermindDL1 commented Mar 12, 2019

I have a server at work and I need to only allow some internal IP's on specific paths, however I only get the proxy's IP (same machine, 127.0.0.1) instead of the actual IP's (10.1.1.28 and 192.168.3.143 as actual examples), yet external IP's are correct. This means that I cannot only allow some paths to certain subnets (like restricting one path to 10.1.0.0/16) unless I want to parse the header myself, which is of course not particularly safe as I have to be careful to do it right.

The plug is defined in the endpoint as:

  plug RemoteIp, headers: ["x-forwarded-for"], proxies: ["127.0.0.1/32"]

And yet it is not rewriting all IP's that I need to handle.

@OvermindDL1
Copy link
Author

OvermindDL1 commented Mar 12, 2019

For note, "x-forwarded-for" is being the IP of, for a real example, "10.1.1.28", and removing the ++ @reserved from the proxies = Keyword.get(opts, :proxies, @proxies) ++ @reserved line in the init/1 callback of the RemoteIp plug is fixing it. This @reserved should not exist, or at the very least should not be hardcoded and rather should be overrideable (or just remove it since it just adds more to the proxy list anyway, which is already controllable via a setting).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant