plug_cloudflare Hex.pm Version Build Status

Inspired by mod_cloudflare, this Elixir plug parses Cloudflare's CF-Connecting-IP HTTP request header into Plug.Conn's remote_ip field.

Setup

To use this plug in your projects, edit your mix.exs file and add the project as a dependency:

defp deps do
[
{ :plug_cloudflare, "~> 1.1.0" }
]
end

Usage

This plug should be one of the first ones in your pipeline. It is therefore recommended to put it in the endpoint instead of a pipeline.

defmodule MyApp.Endpoint do
use Phoenix.Endpoint, otp_app: my_app
plug Plug.Cloudflare
# Other plugs omitted for clarity
end

License

Apache License, Version 2.0