3

I already have my certificate set up. http://www.example.com and https://www.example.com both works.

However, I want to route all traffic from http://www.example.com to go to https://www.example.com.

How can I do that with appengine? I'm using Python.

3 Answers 3

4

Add this to your app.yaml:

handlers: - url: YOUR_URL script: YOUR_SCRIPT secure: always 
Sign up to request clarification or add additional context in comments.

Comments

3

This is an older post but I kept coming across it when trying to figure out how to do this myself with the most recent GAE Flex environment. We're using Django and the headers/keys we had to use to get SSL forced were:

SECURE_SSL_REDIRECT = True SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') SECURE_HSTS_SECONDS = 31536000 # - One Year SECURE_HSTS_INCLUDE_SUBDOMAINS = True SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True SESSION_EXPIRE_AT_BROWSER_CLOSE = True 

Hope that helps.

Comments

0

Extracted from Google document

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

always - Requests for a URL that match this handler that do not use HTTPS are automatically redirected to the HTTPS URL with the same path. Query parameters are preserved for the redirect.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.