Socket
Book a DemoInstallSign in
Socket

corsair

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

corsair

0.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Corsair

A Rack middleware that adds the simple request CORS Access-Control-Allow-Origin header to your application, even if the app raised an exception.

Installation

Require Corsair in your application's Gemfile:

gem "corsair"

In order for Corsair to do its thing it needs to be at the top of the middleware stack. For Rails, this will work nicely in your application.rb:

config.middleware.insert_before 0, "Rack::Corsair"

Options

By default, Corsair will add Access-Control-Allow-Origin: * to all your response headers. You can currently control which domain gets added instead of *, and which resources get the header added. You pass those options in a block, like this:

config.middleware.insert_before 0, "Rack::Corsair" do |corsair|
  corsair.allow_origin "*"
  corsair.allow_resource :things
end

License

Licensed under the MIT license. See the separate MIT-LICENSE file.

FAQs

Package last updated on 20 Feb 2015

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.