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