<p>I want to disable basic auth only on a specific subpath of my App. How this can be done?</p>

<p>e.g.</p>

<p><strong>All subpaths should be basic auth secured:</strong></p>

<pre><code>/ 
</code></pre>

<p><strong>This path should be an exception and public reachable:</strong></p>

<pre><code>/#/public 
</code></pre>

<p>ingress.yaml</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: app
  labels:
    app: app
  annotations:
    kubernetes.io/ingress.class: nginx
    kubernetes.io/tls-acme: "true"
    ingress.kubernetes.io/auth-type: basic
    ingress.kubernetes.io/auth-secret: basic-auth
    ingress.kubernetes.io/auth-realm:  "Authentication Required"
spec:
  rules:
  - host: "&lt;MYHOST&gt;"
    http:
      paths:
      - path: /
        backend:
          serviceName: app-service
          servicePort: 80
  tls:
    - secretName: "app-secret"
      hosts:
      - "&lt;MYHOST&gt;"
</code></pre>

Tim Schwalbe
<p>The path you're trying to use ( <code>/#/public</code> ) never reachs the server, the client send only <code>/</code>. That's the reason why you are unable to disable de auth. </p>

<p>The symbol (#) is a separator for URL fragment identifier. The <a href="https://www.ietf.org/rfc/rfc2396.txt" rel="nofollow noreferrer">rfc2396</a> explains it. </p>

<blockquote>
  <p>The semantics of a fragment identifier is a property of the data
     resulting from a retrieval action, regardless of the type of URI used
     in the referenc </p>
</blockquote>

<p>If you tail the logs of your ingress pod you'll see the url that reachs the backend.</p>

<p>An additional note, if you need the url to reach the server then you need to urlencode it, <code>/%23/public</code> but, it's something with a different meaning.</p>

<p>Regards. </p>
