0
如何覆盖变量的先前设置值?在下面的情况下,当$http_x_forwarded_proto = "https"
$redirectToHttps
未被设置为false但保持为真。我希望这会覆盖价值,但似乎并没有这样做。我怎样才能做到这一点?如何覆盖nginx变量
location/{
set $redirectToHttps false;
set $environment "${APP_ENV}";
# determine if we should force https based on the environment
if ($environment = "production") {
set $redirectToHttps true;
}
if ($environment = "staging") {
set $redirectToHttps true;
}
# determine if we should force https based on the protocol
if ($scheme = "https") {
set $redirectToHttps false;
return 200 "redirectToHttps-scheme: false";
}
if ($http_x_forwarded_proto = "https") {
set $redirectToHttps false;
}
您确定'$ http_x_forwarded_proto'实际上设置为'https'吗? – VBart
@VBart - 是的,我已确认。 – Webnet
你如何检查'$ redirectToHttps'是否仍然是'true'? – VBart