0
変数の以前に設定された値を上書きするにはどうしたらいいですか?以下のシナリオでは、$http_x_forwarded_proto = "https"
$redirectToHttps
がfalseに設定されていないが、trueのままである場合。私はこれが値を上書きすることを期待していますが、そうするようには見えません。これどうやってするの? nginxの中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