0

New to all this, I hope I'll manage to explain things clearly. Thanks for your patience.

Question: Which would be the best approach to change ALL the urls from http to https in a Ruby on Rails existing website?

Context: An old website has all urls as http, it's being migrated to a new server (which will have an ssl certificate).

Steps undertaken so far: Some harcoded urls I changed manually. I've added 'default_url_options protocol: :https' on routes.rb, as suggested here Change protocol to https in all rails helpers I think 'config.force_ssl = true' wouldn't work, as it forces a redirect, but it doesn't change the urls, right?

But there are still some urls with the old http url. Not sure why, maybe it's really obvious, but whit my limited knowledge I don't know what else to check.

Versions are: Ruby 2.1.5 Rails 4.1.4

Thanks for your inputs!

user9421174
  • 29
  • 1
  • 6

2 Answers2

0

You can also change DNS settings and pass through https://www.cloudflare.com/ (they have HTTPS build in with strict redirect to https for non-https requests)

Igor Kasyanchuk
  • 766
  • 6
  • 12
0

Thanks for your answers.

Finally, it was related to the assets (some images come from a cdn, and it wasn't properly configured).

Solution here: https://guides.rubyonrails.org/asset_pipeline.html#set-up-a-cdn-to-serve-static-assets "To set your asset host in Rails, you need to set config.action_controller.asset_host in config/environments/production.rb:"

user9421174
  • 29
  • 1
  • 6