mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
13 lines
549 B
Ruby
13 lines
549 B
Ruby
if Rails.configuration.respond_to?(:enable_rack_cors) && Rails.configuration.enable_rack_cors
|
|
require 'rack/cors'
|
|
|
|
cors_origins = Rails.configuration.respond_to?(:rack_cors_origins) ? Rails.configuration.rack_cors_origins : ['*']
|
|
cors_resource = Rails.configuration.respond_to?(:rack_cors_resource) ? Rails.configuration.rack_cors_resource : ['*', { headers: :any, methods: [:get, :post, :options] }]
|
|
|
|
Rails.configuration.middleware.use Rack::Cors do
|
|
allow do
|
|
origins *cors_origins
|
|
resource *cors_resource
|
|
end
|
|
end
|
|
end
|