简体   繁体   English

如何在没有代理的情况下安全地重定向到 Django 应用程序上的 HTTPS?

[英]How to safely redirect to HTTPS on Django app not behind a proxy?

essentially, I want to turn SECURE_SSL_REDIRECT to true.本质上,我想将 SECURE_SSL_REDIRECT 变为 true。 but reading through the django docs, I get the impression this can compromise the projects security if it's not behind a proxy.但是通读 django 文档,我的印象是,如果它不在代理后面,这可能会危及项目的安全性。

am I understanding that correctly, and if so, how should I go about doing http->https redirects when not behind a proxy?我的理解是否正确,如果是这样,如果不在代理后面,我应该如何进行 http->https 重定向?

thanks!谢谢!

如果有人发现这一点,看起来使用 Heroku 意味着这很好,因为 Heroku 写入 X_FORWARDED_PROTO 标头,无论传入的标头是什么,因此无法将其恶意设置为 https

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM