<p>I have a very simple config but didn't find a direct answer yet.
So there is nginx-ingress and gunicorn service behind.
I want to protect gunicorn backend from all the bots bruteforcing urls.
So I want to redirect only few URLs like:</p>
<ul>
<li>/</li>
<li>/one/*</li>
<li>/two/*</li>
<li>/three/*</li>
</ul>
<p>What is the simplest ingress config to achieve this goal?</p>

TPRLab
<p>You can try this config:</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: app
  labels:
    app.kubernetes.io/name: app
  annotations:
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
spec:
  rules:
    - host: app.domain.com
      http:
        paths:
        - path: /(one|two|three)/
          backend:
            serviceName: app
            servicePort: 5000
        - path: /(.+)
          backend:
            serviceName: app2
            servicePort: 5000
        - path: /
          backend:
            serviceName: app
            servicePort: 5000
</code></pre>
<p>In this example:</p>
<ul>
<li>app - your application</li>
<li>app2 - application, that responding with 403 or other error</li>
</ul>
