title: kubernetes nginx ingress error with configuration-snippet
body: <p>I have following ingress.yaml file</p>
  <pre class="lang-sh prettyprint-override"><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
      name: nginx-configuration-snippet
      annotations:
          nginx.ingress.kubernetes.io/rewrite-target: /$2
          nginx.ingress.kubernetes.io/configuration-snippet: |
            location /base/path/v1/api/update {
                deny all;
                return 404;
              }
  spec:
    rules:
      - http:
          paths:
            - path: /base/path(/|$)(.*)
              backend:
                serviceName: myApi
                servicePort: 8080
  </code></pre>
  <p>But when I send a request to https:///base/path/v1/api/update it succeeds and I got following error in nginx ingress controller</p>
  <pre><code>Error: exit status 1
  2020/08/06 18:35:07 [emerg] 1734#1734: location &quot;/base/path/v1/api/update&quot; is outside location &quot;^/base/path(/|$)(.*)&quot; in /tmp/nginx-cfg008325631:2445
  nginx: [emerg] location &quot;/base/path/v1/api/update&quot; is outside location &quot;^/base/path(/|$)(.*)&quot; in /tmp/nginx-cfg008325631:2445
  nginx: configuration file /tmp/nginx-cfg008325631 test failed
  </code></pre>
  <p>Can somebody help?</p>