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:
What is the simplest ingress config to achieve this goal?
You can try this config:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: app
labels:
app.kubernetes.io/name: app
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
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
In this example: