add Rewrite Rules 301 in nginx ingress controller add Rewrite Rules 301 in nginx ingress controller kubernetes kubernetes

add Rewrite Rules 301 in nginx ingress controller


This is supported in the latest (beta.3) version of the ingress controller.

You set it using annotations. Have a look at the example here

Essentially, when you set up your ingress, you'll need to specify it like so:

apiVersion: extensions/v1beta1kind: Ingressmetadata:  annotations:    ingress.kubernetes.io/rewrite-target: /search  name: rewrite  namespace: defaultspec:  rules:  - host: foo.com    http:      paths:      - backend:          serviceName: my-service          servicePort: 80        path: /all/search