plug_cloudflare
Inspired by mod_cloudflare, this Elixirplug parses CloudFlare‘s CF-Connecting-IP HTTP request header into Plug.Conn‘s remote_ip field.
Setup
To use plug_cloudflare in your projects, edit your mix.exs file and add plug_cloudflare as a dependency:
defp deps do
[
{ :plug_cloudflare, "~> 1.1.0" }
]
endUsage
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
endContribution Process
This project uses the C4 process for all code changes.
“Everyone, without distinction or discrimination, SHALL have an equal right to become a Contributor under the terms of this contract.”