Search code examples
google-app-enginehttpshttp-redirect

How to permanently redirect `http://` and `www.` URLs to `https://`?


I have a Google App Engine project. On this project I have setup a custom domain and an SSL certificate. Therefore, I can use https://www.mysite.xxx, http://www.mysite.xxx and just the naked domain mysite.xxx.

Is it possible to permanently redirect the last two to always use the secure https:// domain using the developers console or do I just have to redirect in the code?


Solution

  • So you can add secure: always to your yaml file

    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. Example

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

    Source