LoginSignup
1

More than 3 years have passed since last update.

[Rails]httpからhttpsにリダイレクトする方法

Posted at

はじめに

オリジナルサービスを作成した際に、httpで作成しておりパスワードを入れる時に
「このサイトは危険です!」みたいな警告が流れてきました。
これは。と思い、URLを見るとhttpのままになっていました。パスワード打つ時にこんな警告が流れるともうそのサイト使いたくならないですよね笑

結論

単純ですが、 config/environments/production.rb にこの一文を書き足す・または修正するだけでhttps化できました。

config/environments/production.rb
config.force_ssl = true

まとめ

railsってなんでもありますね。ほんとすごい。
他にも設定することがあるのかもしれませんが、特に現状は問題なく経過しています。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1