{"id":13508102,"url":"https://github.com/c-rack/plug_cloudflare","last_synced_at":"2025-05-04T04:33:06.048Z","repository":{"id":31025007,"uuid":"34583544","full_name":"c-rack/plug_cloudflare","owner":"c-rack","description":"Parses CloudFlare's CF-Connecting-IP header into Plug.Conn's remote_ip field.","archived":false,"fork":false,"pushed_at":"2022-03-12T10:38:18.000Z","size":52,"stargazers_count":23,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-01T07:33:26.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/c-rack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-25T19:49:41.000Z","updated_at":"2024-07-10T11:27:22.000Z","dependencies_parsed_at":"2022-08-23T15:40:55.316Z","dependency_job_id":null,"html_url":"https://github.com/c-rack/plug_cloudflare","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-rack%2Fplug_cloudflare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-rack%2Fplug_cloudflare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-rack%2Fplug_cloudflare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-rack%2Fplug_cloudflare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/c-rack","download_url":"https://codeload.github.com/c-rack/plug_cloudflare/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224385194,"owners_count":17302442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:47.998Z","updated_at":"2024-11-13T03:38:03.137Z","avatar_url":"https://github.com/c-rack.png","language":"Elixir","readme":"# plug_cloudflare\n\n[![Build Status](https://travis-ci.org/c-rack/plug_cloudflare.png?branch=master)](https://travis-ci.org/c-rack/plug_cloudflare)\n[![Module Version](https://img.shields.io/hexpm/v/plug_cloudflare.svg)](https://hex.pm/packages/plug_cloudflare)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/plug_cloudflare/)\n[![Total Download](https://img.shields.io/hexpm/dt/plug_cloudflare.svg)](https://hex.pm/packages/plug_cloudflare)\n[![License](https://img.shields.io/hexpm/l/plug_cloudflare.svg)](https://github.com/c-rack/plug_cloudflare/blob/master/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/c-rack/plug_cloudflare.svg)](https://github.com/c-rack/plug_cloudflare/commits/master)\n\nInspired by [mod_cloudflare](https://github.com/cloudflare/mod_cloudflare), this [Elixir](http://elixir-lang.org/) [plug](https://github.com/elixir-lang/plug) parses [CloudFlare](https://www.cloudflare.com/)'s `CF-Connecting-IP` HTTP request header into [Plug.Conn](http://hexdocs.pm/plug/Plug.Conn.html)'s `remote_ip` field.\n\n\n## Setup\n\nTo use `:plug_cloudflare` in your projects, edit your `mix.exs` file and add `:plug_cloudflare` as a dependency:\n\n```elixir\ndefp deps do\n  [\n    {:plug_cloudflare, \"\u003e= 1.2.0\"}\n  ]\nend\n```\n\n## Usage\n\nThis plug should be one of the first ones in your pipeline.\nIt is therefore recommended to put it in the endpoint instead of a pipeline.\n\n```elixir\ndefmodule MyApp.Endpoint do\n  use Phoenix.Endpoint, otp_app: my_app\n\n  plug Plug.CloudFlare\n\n  # Other plugs omitted for clarity\n\nend\n```\n\n## Behavior\n\nThis plug makes an effort to avoid tampering with the remote IP if the app is not running behind Cloudflare.  The remote IP will only be changed by this plug if:\n\n1.  The CF-Connecting-IP header is present\n1.  The CF-Connecting-IP header parses to a valid IP address\n1.  The peer making the request is a Cloudflare IP address\n\n## Contribution Process\n\nThis project uses the [C4.1 process](http://rfc.zeromq.org/spec:22) for all code changes.\n\n\u003e \"Everyone, without distinction or discrimination, SHALL have an equal right to become a Contributor under the\nterms of this contract.\"\n\n## Copyright and License\n\nCopyright (c) 2015 Constantin Rack\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","funding_links":[],"categories":["Framework Components"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc-rack%2Fplug_cloudflare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fc-rack%2Fplug_cloudflare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc-rack%2Fplug_cloudflare/lists"}