0

I have an nginx config for which I need to enable ssi on or off based on a condition. I have tried moving ssi inside an if condition but nginx doesn't allow that.

location / {
     if(condition) {
          ssi on;
     }
}

I then tried setting on in a variable and use that

location / {
  set $ssi_flag off
  if(condition) {
      set $ssi_flag on
  }
  ssi $ssi_flag
}

For this nginx throws error ssi expects value on and off. How can I set this. A generic solution which can be used for other modules like ssi which expects on or off is very much appreciated.

javaDeveloper
  • 1,403
  • 3
  • 28
  • 42

0 Answers0