lundi 6 avril 2015

How can I add header conditionally in nginx configuration?


Vote count:

0




How can I add header conditionally in nginx configuration?


At first I tried like this.



location / {
add_header X-TEST-0 always;

set $true 1;
if ($true) {
add_header X-TEST-1 true;
}

add_header X-TEST-2 111;
}


Although I expected my nginx set all header(X-TEST-0,1,2), it added header only X-TEST-1.


Next I tried like this.



location / {
add_header X-TEST-0 always;

##set $true 1;
##if ($true) {
## add_header X-TEST-1 true;
##}

add_header X-TEST-2 111;
}


My nginx added header X-TEST-1 and X-TEST-2 as I expected.


My quastions are...




  1. How can I add header conditionally?




  2. Why does nginx add only X-TEST-1 with my first example above?




Thanks in advance!



asked 25 secs ago

yazaki

441






How can I add header conditionally in nginx configuration?

Aucun commentaire:

Enregistrer un commentaire