问题
I have this code
<iframe src="http://matrix.crebtools.com/Matrix/public/IDX.aspx?idx=5a251ec" width="860px" height="520px"></iframe>
It work locally but its not working on heroku On heroku it shows white empty space
so i put in application.rb this code but its still not working
In applications.rb
module MohamedHatata
class Application < Rails::Application
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'ALLOWALL'
}
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
I spend two days just to try figure out the solution please any one help me
This is my website https://mohamed-hatata.herokuapp.com/downsizes/new
回答1:
If you open your javascript console you will find mixed content warning.
Mixed Content: The page at 'https://mohamed-hatata.herokuapp.com/downsizes/new' was loaded over HTTPS, but requested an insecure resource 'http://matrix.crebtools.com/Matrix/public/IDX.aspx?idx=5a251ec'. This request has been blocked; the content must be served over HTTPS.
If you visit your site at http://mohamed-hatata.herokuapp.com/downsizes/new instead of https://mohamed-hatata.herokuapp.com/downsizes/new your iframe loads fine.
config.action_dispatch.default_headers is to be set by the site which is getting loaded inside your application and not by your application itself.
Read more on Mixed Content - https://developer.mozilla.org/en/docs/Security/MixedContent
来源:https://stackoverflow.com/questions/31685402/iframe-not-working-on-heroku