我有一个烧瓶应用程序,由uwsgi托管,使用nginx作为 uwsgi 的反向代理,使用内置的uwsgi 代理模块。每当我访问重定向到另一个页面的页面时,Location 标头都会指向非 HTTPS URL。例如:
$ socat openssl:my-web-server:443 stdio
GET / HTTP/1.0
Host: my-web-server
HTTP/1.1 302 FOUND
Server: nginx/1.0.4
[...]
Location: http://my-web-server/login
我的 nginx 配置如下所示:
server {
listen 80;
listen 443 ssl;
server_name my-web-server;
charset utf-8;
ssl_certificate /etc/nginx/certs/server.pem;
ssl_certificate_key /etc/nginx/certs/server.key;
location / {
uwsgi_pass unix:/tmp/uwsgi.sock;
include uwsgi_params;
}
}