How to enforce HTTPS traffic to Google App Engine with custom domain?

前端 未结 4 988
说谎
说谎 2020-12-18 00:29

I have a site on Google Domains (www.example.com) and it\'s hosted with Gcloud. I followed the instructions listed here to set up SSL and https: https://cloud.google.com/app

4条回答
  •  悲&欢浪女
    2020-12-18 00:37

    Not sure what backend language you are using, but you can brute-force to ssl by checking the request header then redirecting. Example:

    if request.environ.get('HTTPS') == 'off':
        return redirect('https://www.example.com' + request.environ.get('PATH_INFO'), 301)
    

提交回复
热议问题