We have a kubernetes nginx-ingress controller to manage our API connectivity. For it to work properly the endpoints need to see the requesting URI as “/” and not “/endpoint/something”. So we have created rewrite rules which work fine until we enable Cloudflare. Once enabled it appears that the rewrite rules are being ignored and the endpoints are receiving requests for “/endpoint/something” instead of “/”. I’ve looked at page rules but cannot seem to find a way to fix this. Suggestions welcome!
Note that this is behind SSL. Any help appreciated!
Our Ingress rules look like:
apiVersion: extensions/v1beta1 kind: Ingress metadata: name: my-ingress annotations: kubernetes.io/ingress.class: "nginx" nginx.com/health-checks: "true" nginx.ingress.kubernetes.io/rewrite-target: /$1 nginx.ingress.kubernetes.io/ssl-redirect: false nginx.ingress.kubernetes.io/force-ssl-redirect: false name: rewrite namespace: default spec: rules: - host: "mysite.com" http: paths: - path: /api/v1/something/?(.*) backend: serviceName: myservice-api servicePort: 5006