'How to use multiple rules in Ingress Controller

Currently I have the Ingress resource which allows the rule (lets say rule A) based on IP ranges

    nginx.ingress.kubernetes.io/configuration-snippet: |
      allow 111.111.111.0/24;
      allow 111.111.222.0/24;
      deny all;

I need to allow 1 more rule (lets say Rule B) to allow traffic if it contains a particular header (Not sure if below should be added under configuration-snippet or server-snippet):

    nginx.ingress.kubernetes.io/configuration-snippet: |
      if ($http_x_azure_fdid !~* "55ce4ed1-4b06-4bf1-b40e-4638452104da" ){
         return 403;
      }

How can I keep both the rules and ensure one does not override the other. If any of the Rule A or Rule B is satisfied, I can allow the traffic entry.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source