https://github.com/ksylvest/cloudflare-ips
Configure a Ruby on Rails Application w/ Cloudflare Proxy IPs
https://github.com/ksylvest/cloudflare-ips
cloudflare rails ruby
Last synced: 4 months ago
JSON representation
Configure a Ruby on Rails Application w/ Cloudflare Proxy IPs
- Host: GitHub
- URL: https://github.com/ksylvest/cloudflare-ips
- Owner: ksylvest
- License: mit
- Created: 2024-11-08T17:53:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-10T14:05:04.000Z (over 1 year ago)
- Last Synced: 2025-01-19T23:57:25.314Z (over 1 year ago)
- Topics: cloudflare, rails, ruby
- Language: Ruby
- Homepage: https://cloudflare-ips.ksylvest.com/
- Size: 29.3 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloudflare IPs
[](https://github.com/ksylvest/cloudflare-ips/blob/main/LICENSE)
[](https://rubygems.org/gems/cloudflare-ips)
[](https://github.com/ksylvest/cloudflare-ips)
[](https://cloudflare-ips.ksylvest.com)
[](https://circleci.com/gh/ksylvest/cloudflare-ips)
CloudflareIPs assigns the proxy [IPv4](https://www.cloudflare.com/ips-v4/) and [IPv6](https://www.cloudflare.com/ips-v6/) Cloudflare IPs allowing `request.remote_ip` to return back the actual IP instead of a Cloudflare datacenter IP.
## Installation
Configure the Cloudflare IPs gem for any environment needed:
```ruby
gem "cloudflare-ips"
```
```bash
$ bundle
```
## Usage
Use `request.remote_ip` instead of `request.ip` to properly retrieve IPs:
```ruby
request.remote_ip
```