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

conn.remove_ip is always 127.0.0.1 #2009

Closed
paragasu opened this issue Nov 24, 2016 · 1 comment
Closed

conn.remove_ip is always 127.0.0.1 #2009

paragasu opened this issue Nov 24, 2016 · 1 comment

Comments

@paragasu
Copy link

Precheck

I am running phoenix behind nginx proxy and setup according to the suggested configuration
as mention in the docs Phoenix behind proxy

Environment

  • Elixir 1.3.3
  • Phoenix 1.2.1
  • NodeJS v5.12.0
  • NPM version 3.3.4
  • Operating system: Linux 4.8.0-1-amd64, Debian Jessie

Expected behavior

I have a controller code as below,

def create(conn, %{"scammer" => scammer_params}) do
    remote_ip = Enum.join(Tuple.to_list(conn.remote_ip), ".")`
end

Will return current user remote IP address

Actual behavior

Always return 127.0.0.1 every time.

@josevalim
Copy link
Member

We don't perform IP rewriting automatically because doing so without an actual proxy is a security risk. Here is a discussion with snippets and projects you could use: elixir-plug/plug#319

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

2 participants