I write a web app on Google App Engine using Python.
Users can access my site at http://[youraccount].appspot.com and https://[youraccount].appspot.com
How do I redirect the http traffic to the https site.
In other words, how do I force this site to use SSL(https)
for security purpose (and for better SEO)?
2
Answers
Just add a
secure
parameter to theapp.yaml
file.See Configuring Secure URLs in app.yaml
For a Django project running on Google App Engine in the Flexible Environment, setting
secure: always
in app.yaml doesn’t work [Google Cloud docs].Instead, in my
settings.py
file, I added the following [Django docs]:Note that
SECURE_PROXY_SSL_HEADER
is needed because the servers sit behind a load balancer.