Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Google App Engine [python] to use SSL (https)?

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)?

like image 955
Aaron Avatar asked Mar 02 '15 12:03

Aaron


People also ask

What is App Engine HTTP?

App Engine is a fully managed, serverless platform for developing and hosting web applications at scale. You can choose from several popular languages, libraries, and frameworks to develop your apps, and then let App Engine take care of provisioning servers and scaling your app instances based on demand.


1 Answers

Just add a secure parameter to the app.yaml file.

handlers:
- url: /youraccount/.*
  script: accounts.py
  login: required
  secure: always

See Configuring Secure URLs in app.yaml

Google App Engine supports secure connections via HTTPS for URLs using the *.appspot.com domain. When a request accesses a URL using HTTPS, and that URL is configured to use HTTPS in the app.yaml file, both the request data and the response data are encrypted by the sender before they are transmitted, and decrypted by the recipient after they are received. Secure connections are useful for protecting customer data, such as contact information, passwords, and private messages.

like image 177
Aaron Avatar answered Sep 21 '22 22:09

Aaron