简体   繁体   中英

http instead of https for heroku sites

I have built a rails app and have pushed it to production via heroku. The default address starts with https instead of http. Can I force it to start with http? In my production.rb file, I have the following:

config.force_ssl = false

I also tried to comment out that line, but it still doesn't work. Is there anything else I need to do?

You need to do this basic steps:

  • Purchase an SSL certificate
  • Provision the ssl:endpoint addon heroku addons:add ssl:endpoint
  • Upload your certificate
  • Update your DNS
  • Configure your Rails app with config.force_ssl = true

For more information see this official guide or this another :

When I got this right, you want to force use of http instead of https. I don't know why you would want this and I would not recommend to do so, but you could use the code example from this answer :

class ApplicationController < ActionController::Base
  before_filter do
    if request.ssl? && Rails.env.production?
      redirect_to :protocol => 'http://', :status => :moved_permanently
    end
  end
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM