简体   繁体   English

Django 下一个 HTTPS 网址(Nginx)

[英]Django next url to HTTPS (Nginx)

I have added a SSL certificate to my nginx application, everything works fine, but when django paginates for the next url it uses: http:// not https:// How can I change this?我在我的 nginx 应用程序中添加了一个 SSL 证书,一切正常,但是当 django 为它使用的下一个 url 分页时: http://不是https://我该如何更改? 在此处输入图片说明

I have solved the issue: Under proxy_pass http://django;我已经解决了这个问题:proxy_pass http://django; SET

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

Also need to set还需要设置

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

in setting.py file.在setting.py文件中。

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

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