Skip to content

Very simple plug which reads `X-Forwarded-For` or `Forwarded` header according to rfc7239 and fill `conn.remote_ip` with the root client ip.

License

Notifications You must be signed in to change notification settings

kiere/plug_forwarded_peer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plug ForwardedPeer

Very simple plug which reads X-Forwarded-For or Forwarded header according to rfc7239 and fill conn.remote_ip with the root client ip.

Usage

defmodule MyPlug do
  use Plug.Builder
  plug PlugForwardedPeer
end

With Phoenix

defmodule MyAppWeb.Endpoint do

  # ... lots of code

  plug PlugForwardedPeer # <- Insert before Router to have it cover all pipelines
  plug MyAppWeb.Router
end

About

Very simple plug which reads `X-Forwarded-For` or `Forwarded` header according to rfc7239 and fill `conn.remote_ip` with the root client ip.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 100.0%