Oauth将我重定向到http而不是https

时间:2018-05-23 14:12:15

标签: python google-app-engine

我在使用flask和oauth2client的python3.6应用程序上工作,并在灵活的环境中部署。

命令:gcloud app browse输出链接:https://xxx.appspot.com

当我访问它时,我被重定向到默认路由,这需要auth,然后重定向到选择我的谷歌帐户,之后我再次被重定向到默认路由,但这次是http而不是https。

这是设置默认路线的代码:

@app.route("/")
    def index():
        return redirect(url_for('crud.home'))

这是默认路由的控制器方法:

@crud.route('/home')
@oauth2.required
def home():
    return render_template('home.html')

为什么?如何让它重定向回到https?

1 个答案:

答案 0 :(得分:0)

您可以使用url_for(..., _scheme="https")实现它的另一种方法是更改​​服务器设置以使用https重写所有http请求。

相关问题