Giter VIP home page Giter VIP logo

rack-strip-cookies's Introduction

Rack::StripCookies

Rack::StripCookies is a straightforward Rack middleware that deletes cookies at designated paths.

Gem Version Git Tag Licence Build Status

Getting Started

Installation

To include this gem in your project, add the following line to your Gemfile:

gem 'rack-strip-cookies', '~> 1.0.5'

Then, run the bundle command:

bundle

Overview

The primary aim of this gem is to not only prevent a client from receiving a cookie through the Set-Cookie header, but also to eliminate cookies sent in the request. Consequently, provided the middleware is correctly positioned in the stack, any cookies sent by the client will not reach your application layer.

Usage Scenarios

  • If a third-party library in your application is defective and throws an exception when cookies are present in a request (e.g., an authentication engine), this gem can be helpful.
  • This gem provides a simple solution if you need to disable session cookies in your framework.
  • It allows you to selectively disable cookies on specific paths, which can be configured when integrating the middleware.

Integration with Ruby on Rails

If you want to make this middleware available across all environments, open config/application.rb and add the following line in class Application < Rails::Application:

config.middleware.insert_before(ActionDispatch::Cookies, Rack::StripCookies, paths: %w(/oauth2/token))

If you wish to enable the middleware only in certain environments, modify the corresponding environment files.

To confirm the middleware's position, run the rake middleware command in the root directory of your application.

How to Contribute

We welcome contributions to improve this project. Here's how you can participate:

  1. Fork this repository.
  2. Create a new feature branch on your local copy (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push your branch to your forked repository (git push origin my-new-feature).
  5. Open a new Pull Request on this repository for us to review and merge your changes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.