Ingress-nginx: Rewrite Annotation does not work, NGINX: 0.9.0

Created on 22 Dec 2017  路  3Comments  路  Source: kubernetes/ingress-nginx

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/.):
No, just report a rewrite issue for Nginx0.9.0

What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.):

annotations -> nginx.ingress.kubernetes.io/rewrite-target

Is this a BUG REPORT or FEATURE REQUEST? (choose one):
BUG REPORT

NGINX Ingress controller version:
NGINX: 0.9.0

Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2017-12-15T21:07:38Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2017-12-15T20:55:30Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}

Environment:
CENTOS7

  • Cloud provider or hardware configuration: vmware
  • OS (e.g. from /etc/os-release): CENTOS7
  • Kernel (e.g. uname -a):Linux master1 3.10.0-693.11.1.el7.x86_64 #1 SMP Mon Dec 4 23:52:40 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Install tools: Kubernetes + docker
  • Others:

What happened:
This annotation " nginx.ingress.kubernetes.io/rewrite-target" does not work in nginx-ingress-controller:0.9.0. The URL "/lizcloud/api" was kept and forwarded to gateway.

but worked fine in nginx-ingress-controller:0.9.0-beta.11

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: lizcloud-ingress
  annotations:
    ingress.kubernetes.io/rewrite-target: /
    ingress.kubernetes.io/ssl-redirect: "false"
    ingress.kubernetes.io/force-ssl-redirect: "false"
  namespace: default
spec:
  rules:
  - host: dev.gemii.cc
    http:
      paths:
      - path: /lizcloud/api
        backend:
          serviceName: gateway
          servicePort: 10000

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know:

Most helpful comment

Since nginx-ingress-controller:0.9.0-beta.18, annotations prefix defaults to _nginx.ingress.kubernetes.io_. Try to change your annotations to:

nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"

Or specify the flag --annotations-prefix ingress.kubernetes.io when starting the controller (see Comand Line arguments)

All 3 comments

Since nginx-ingress-controller:0.9.0-beta.18, annotations prefix defaults to _nginx.ingress.kubernetes.io_. Try to change your annotations to:

nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"

Or specify the flag --annotations-prefix ingress.kubernetes.io when starting the controller (see Comand Line arguments)

Thank you!!!

Super helpful as the docs https://kubernetes.io/docs/concepts/services-networking/ingress/#single-service-ingress dont mention nginx.ingress.kubernetes.io vs ingress.kubernetes.io

Was this page helpful?
0 / 5 - 0 ratings