2014-02-10 02:11:52 -05:00
|
|
|
if GlobalSetting.enable_cors
|
2013-04-22 05:16:58 -04:00
|
|
|
require 'rack/cors'
|
|
|
|
|
|
|
|
Rails.configuration.middleware.use Rack::Cors do
|
|
|
|
allow do
|
2014-06-13 14:47:09 -04:00
|
|
|
origins GlobalSetting.cors_origin.split(',').map(&:strip)
|
2014-02-10 02:11:52 -05:00
|
|
|
resource '*', headers: :any, methods: [:get, :post, :options]
|
2013-04-22 05:16:58 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|