Commit 303523746efc8d0b52d4bb21cdf5d40f30613dc4
1 parent
e5ecf4b1
Exists in
master
and in
29 other branches
api: (finally) fix cors application
Showing
2 changed files
with
7 additions
and
7 deletions
Show diff stats
config.ru
| @@ -6,6 +6,13 @@ require ::File.expand_path('../config/environment', __FILE__) | @@ -6,6 +6,13 @@ require ::File.expand_path('../config/environment', __FILE__) | ||
| 6 | #use Rails::Rack::Static | 6 | #use Rails::Rack::Static |
| 7 | #run ActionController::Dispatcher.new | 7 | #run ActionController::Dispatcher.new |
| 8 | 8 | ||
| 9 | +use Rack::Cors do | ||
| 10 | + allow do | ||
| 11 | + origins '*' | ||
| 12 | + resource '/api/*', :headers => :any, :methods => [:get, :post] | ||
| 13 | + end | ||
| 14 | +end | ||
| 15 | + | ||
| 9 | rails_app = Rack::Builder.new do | 16 | rails_app = Rack::Builder.new do |
| 10 | run Noosfero::Application | 17 | run Noosfero::Application |
| 11 | end | 18 | end |
config/application.rb
| @@ -133,12 +133,5 @@ module Noosfero | @@ -133,12 +133,5 @@ module Noosfero | ||
| 133 | 133 | ||
| 134 | Noosfero::Plugin.setup(config) | 134 | Noosfero::Plugin.setup(config) |
| 135 | 135 | ||
| 136 | - config.middleware.use Rack::Cors do | ||
| 137 | - allow do | ||
| 138 | - origins '*' | ||
| 139 | - resource '/api/*', :headers => :any, :methods => [:get, :post] | ||
| 140 | - end | ||
| 141 | - end | ||
| 142 | - | ||
| 143 | end | 136 | end |
| 144 | end | 137 | end |