fix: fonts cors issue with cdn (#1182)

This commit is contained in:
Sony Mathew 2020-09-01 11:39:18 +05:30 committed by GitHub
parent 29d13fbb4f
commit cb6fc9fb2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 0 deletions

View file

@ -119,4 +119,13 @@ Rails.application.configure do
config.action_mailbox.ingress = ENV.fetch('RAILS_INBOUND_EMAIL_SERVICE', 'relay').to_sym
Rails.application.routes.default_url_options = { host: ENV['FRONTEND_URL'] }
# font cors issue with CDN
# Ref: https://stackoverflow.com/questions/56960709/rails-font-cors-policy
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/packs/*', headers: :any, methods: [:get, :options]
end
end
end

View file

@ -102,4 +102,13 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
# font cors issue with CDN
# Ref: https://stackoverflow.com/questions/56960709/rails-font-cors-policy
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/packs/*', headers: :any, methods: [:get, :options]
end
end
end

View file

@ -51,4 +51,13 @@ Rails.application.configure do
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
config.log_level = ENV.fetch('LOG_LEVEL', 'debug').to_sym
# font cors issue with CDN
# Ref: https://stackoverflow.com/questions/56960709/rails-font-cors-policy
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/packs/*', headers: :any, methods: [:get, :options]
end
end
end

View file

@ -13,3 +13,7 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules')
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
Rails.application.config.assets.precompile += %w[dashboardChart.js]
# to take care of fonts in assets pre-compiling
# Ref: https://stackoverflow.com/questions/56960709/rails-font-cors-policy
Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf|woff2)$/