You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use :plug_cloudflare in your projects, edit your mix.exs file and add :plug_cloudflare as a dependency:
defpdepsdo[{:plug_cloudflare,">= 1.2.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.
defmoduleMyApp.EndpointdousePhoenix.Endpoint,otp_app: my_appplugPlug.CloudFlare# Other plugs omitted for clarityend
Behavior
This 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:
The CF-Connecting-IP header is present
The CF-Connecting-IP header parses to a valid IP address
The peer making the request is a Cloudflare IP address
Contribution Process
This project uses the C4.1 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."
Copyright and License
Copyright (c) 2015 Constantin Rack
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
About
Parses CloudFlare's CF-Connecting-IP header into Plug.Conn's remote_ip field.