Sha256: 14738601a3592b2a17a73dcf8ef1d9cc980344f64fa8f17838931689895e66e0

Contents?: true

Size: 427 Bytes

Versions: 5

Compression:

Stored size: 427 Bytes

Contents

# CORS

Use [rack-cors](https://github.com/cyu/rack-cors) to enable CORS.

```ruby
require 'rack/cors'
use Rack::Cors do
  allow do
    origins '*'
    resource '*', headers: :any, methods: [ :get, :post, :put, :delete, :options ]
  end
end
```

Alternatively you can set CORS headers in a `before` block.

```ruby
before do
  header['Access-Control-Allow-Origin'] = '*'
  header['Access-Control-Request-Method'] = '*'
end
```

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
r2-oas-0.3.1 docs/setting/CORS.md
r2-oas-0.3.0 docs/setting/CORS.md
r2-oas-0.2.0 docs/setting/CORS.md
r2-oas-0.1.3 docs/setting/CORS.md
r2-oas-0.1.2 docs/setting/CORS.md