yandex / gixy

Nginx configuration static analyzer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail on nested `if` statements

fabioknoedt opened this issue · comments

Nginx doesn't support nested if statements:
http://rosslawley.co.uk/archive/old/2010/01/04/nginx-how-to-multiple-if-statements/

Does it make sense to detect these syntax errors?

I think the detection of syntax errors does not need for gixy.
For this purpose I prefer to run nginx -t, benefits:

  • checks the availability of the necessary modules;
  • zero false positive :-)

Good point.
My use case is in a piece of nginx configuration inside of an ingress config snippet though:
ingress.kubernetes.io/configuration-snippet, it's not the whole config file.
I know, edge case 😄

metadata:
  name: my-name
  annotations:
    kubernetes.io/ingress.class: nginx
    ingress.kubernetes.io/force-ssl-redirect: "true"
    ingress.kubernetes.io/proxy-body-size: '0'
    ingress.kubernetes.io/configuration-snippet: |
        <snippet here>