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

kbrw/plug_forwarded_peer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 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.

Installation

Add to your list of dependencies in mix.exs:

def deps do
  [
    {:plug_forwarded_peer, "~> 0.1.0"}
  ]
end

Usage

In Phoenix:

defmodule MyApp.Endpoint do
  use Phoenix.Endpoint, otp_app: :my_app

  ...

  plug PlugForwardedPeer
end

Or in plain elixir:

defmodule MyPlug do
  use Plug.Builder
  plug PlugForwardedPeer
end

CONTRIBUTING

Hi, and thank you for wanting to contribute. Please refer to the centralized informations available at: https://github.com/kbrw#contributing

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages