diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index b15ace3..812a11e 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -28,8 +28,10 @@ Rails.application.config.middleware.insert_before 0, Rack::Cors do # Cacheamos la respuesta para no tener que volver a procesarla # cada vez. Rails.cache.fetch(source, expires_in: 1.hour) do - if (name = URI(source)&.host&.split('.', 2)&.first).present? - Site.where(name: name).pluck(:name).first.present? + uri = URI(source) + + if (name = uri&.host&.split('.', 2)&.first).present? + Site.where(name: [name, uri.host + '.']).pluck(:name).first.present? else false end