<p>Running in Minikube, I have the following ingress, with the necessary backend:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
    - http:
        paths:
        - path: /config/
          backend:
            serviceName: api-gateway
            servicePort: web
</code></pre>

<p>The intention is to serve the gateway's web UI, which expects the path to be <code>/</code>, otherwise it assumes the it is a logical path and attempts to forward the request to the correct microservice.</p>

<p>The rewrite of the path is not working as I expect it. It doesn't replace <code>/config/</code> with <code>/</code>. Am I misunderstanding <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/rewrite/README.md" rel="nofollow noreferrer">the example</a>?</p>

<p>In the logs of the nginx controller I see:</p>

<pre><code>192.168.99.1 - [192.168.99.1] - - [13/Dec/2017:08:54:11 +0000] "GET /config HTTP/1.1" 301 185 "-" "curl/7.55.1" 78 0.000 [-] - - - -
192.168.99.1 - [192.168.99.1] - - [13/Dec/2017:08:54:11 +0000] "GET /config/ HTTP/1.1" 404 154 "-" "curl/7.55.1" 79 0.010 [dev-api-gateway-web] 172.17.0.10:8080 143 0.010 404
</code></pre>

<p>That's telling me that a request for <code>/config</code> got rewritten to <code>/config/</code> and resulted in a 404.</p>

<p><strong>How do I rewrite <code>/config</code> to <code>/</code>?</strong></p>

<p>You are misunderstanding the example. With your configuration requests to the rewrite target <code>/</code> will be rewritten to <code>/config/</code>, not the other way around. So you need to switch paths: use <code>/config</code> as rewrite target, and set the <code>/</code> path in the rule.</p>

<p>So the rewrite target is always where the external requests go to, the rule path where the requests to the service/pod go to. </p>
