Iframe not working on heroku

非 Y 不嫁゛ 提交于 2021-01-01 06:20:30

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!