将站点移至代理后,favicon 和 header 不再使用 https

好吧,在经历了多次不成功的尝试后,我终于找到了在 force_https=true 的情况下实现有效登录的方法。

在 Docker 环境中,我对 /etc/nginx/conf.d/discourse.conf 进行了如下修补:


location @discourse {
limit_conn connperip 20;
limit_req zone=flood burst=12 nodelay;
limit_req zone=bot burst=100 nodelay;
proxy_set_header Host $http_host;
proxy_set_header X-Request-Start “t=${msec}”;
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 https; # $thescheme; ← 我修改的地方
proxy_pass http://discourse;
}

至少在我的环境中,只有在这一部分生效。

现在运行得非常顺利!