mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-17 19:12:37 -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
|