【发布时间】:2016-05-10 19:52:42
【问题描述】:
我的申请遇到了一些问题。在重定向期间,我的烧瓶应用程序丢失了 https 并改为重定向到 http。
我一直在努力寻找解决方案,但没有任何效果。
我的应用程序(位置/)的nginx配置如下:
proxy_pass http://localhost:5400;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-port 443;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
(互联网上的一些示例说使用“X-Forwarded-Proto”。我已经尝试过但没有成功。并且还使用“ssl”或“https”作为该参数的值。
烧瓶应用程序(before_request :) 中的简单打印表明,尽管我在客户端和 nginx 之间使用 https,但它仍然是 http-requests 发出的事件。
print(request.environ["wsgi.url_scheme"])
我做错了什么?
【问题讨论】:
-
你解决了吗?
标签: redirect nginx https flask gunicorn