LoginSignup
2
4

More than 5 years have passed since last update.

Djangoでhttpsにリダイレクトする簡単な方法

Last updated at Posted at 2019-03-20

Djangoで作成したサイトをhttpsにリダイレクトさせるにはsetting.pyに以下の二行を追加します。

setting.py
SECURE_SSL_REDIRECT = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

私はDjangoとAWSで自分のサイトを作成しているのですが、この機能を知らずにAWSの設定を変えたり、Apache使ったり苦戦してすごく時間を取られました笑

2
4
0

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
2
4