Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rack-cors-halt

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rack-cors-halt

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

rack-cors-halt

This gem provides support to prevent a request from hitting the controller when the CORS validation fails.

Important notice

This gem will only work for gem Rack::Cors at version '0.3.0'. At this time, November 18th 2014, the '0.3.0' version is in the 'master' branch, so you need to include the gem like this

gem 'rack-cors', :require => 'rack/cors', github: "cyu/rack-cors", branch: 'master'

Installation

In your Gemfile add the line

  gem 'rack-cors-halt'

and then run

bundle

or install it yourself with

gem install rack-cors-halt

Configuration

Rack

In the config.rufile you need to configure the Rack::Cors::Halt middleware by passing it in the use command:

use Rack::Cors::Halt

Rails

In your config/application.rb you'll need something like this:

module YourApp
  class Application < Rails::Application

    # ...

    config.middleware.insert_before 1, "Rack::Cors::Halt"
      
  end
end

why .insert_before 1? Typically the first middleware will be the Rack::Cors one, so the best approach is to place the Rack::Cors::Halt beneath that one so no more middlewares are runned.

FAQs

Package last updated on 19 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc