<p>I would like to block <code>/public/configs</code> in my k8s ingress.</p>
<p>My current settings doesnt work.</p>
<pre><code>    - host: example.com
      http:
        paths:
          - path: /*
            pathType: ImplementationSpecific
            backend:
              service:
                name: service-myapp
                port:
                  number: 80
          - path: /public/configs
            pathType: ImplementationSpecific
            backend:
              service:
                name: service-myapp
                port:
                  number: 88 // fake port
</code></pre>
<p>Is there any better (easy) way?</p>

teteyi3241
<p>1- Create a dummy service and send it to that:</p>
<pre><code>  - path: /public/configs
    pathType: ImplementationSpecific
    backend:
      service:
        name: dummy-service
        port:
          number: 80
</code></pre>
<p>2- use <code>server-snippets</code> as bellow to return 403 or any error you want:</p>
<p>a) for k8s nginx ingress:</p>
<pre><code>  annotations:
    nginx.ingress.kubernetes.io/server-snippet: |
      location ~* &quot;^/public/configs&quot; {
          deny all;
          return 403;
        }
</code></pre>
<p>b) for nginx ingress:</p>
<pre><code>  annotations:
    nginx.org/server-snippet: |
      location ~* &quot;^/public/configs&quot; {
          deny all;
          return 403;
        }
</code></pre>
