<commit_before># Rack::Cloudflare

A collection of middlewares that makes it nicer to work with Cloudflare.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rack-cloudflare', github: 'tatey/rack-cloudflare'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install rack-cloudflare

## Usage

Add these middlewares to your stack.

    # config/application.rb
    config.middleware.insert_before ActionDispatch::RemoteIp, Rack::Cloudflare::XForwardedFor
    config.middleware.insert_before Rack::Lock, Rack::Cloudflare::CacheControl


## Contributing

1. Fork it ( https://github.com/[my-github-username]/rack-cloudflare/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request<commit_msg>Update README to specify expected operation and add railgun option<commit_after># Rack::Cloudflare

A collection of middlewares that makes it nicer to work with Cloudflare.

Note that this middleware expects the app to behind another reverse proxy (HAProxy/nginx) with the last IP in `X-Forwarded-For` to be the IP of the client.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rack-cloudflare', github: 'tatey/rack-cloudflare'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install rack-cloudflare

## Usage

Add these middlewares to your stack.

    # config/application.rb
    config.middleware.insert_before ActionDispatch::RemoteIp, Rack::Cloudflare::XForwardedFor
    config.middleware.insert_before Rack::Lock, Rack::Cloudflare::CacheControl

If you are using Railgun, specify the Railgun source IP by doing:

    # config/application.rb
    config.middleware.insert_before ActionDispatch::RemoteIp, Rack::Cloudflare::XForwardedFor, additional_ranges: ["<ip of railgun>/32"]


## Contributing

1. Fork it ( https://github.com/[my-github-username]/rack-cloudflare/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
{'fraction_non_alphanumeric': 0.09915518008003557, 'fraction_numerical': 0.005335704757670075, 'mean_word_length': 4.50122249388753, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5658624', 'n_tokens_mistral': 715, 'n_tokens_neox': 655, 'n_words': 238}