<p>I have a Traefik on Kubernetes that acts as ingress and load balancer. 
I have a ingress setup like this:</p>

<pre><code>{
    "apiVersion": "extensions/v1beta1",
    "kind": "Ingress",
    "metadata": {
        "name": "nppl-ingress",
        "annotations": {
            "kubernetes.io/ingress.class": "traefik",
            "traefik.frontend.rule.type": "PathPrefixStrip"
        }
    },
    "spec": {
        "rules": [
            {
                "host": "" ,
                "http": {
                    "paths": [
                        {
                            "path": "/discover-service",
                            "backend": {
                                "serviceName": "discover-service",
                                "servicePort": "discover-port"
                            }
                        },
                        {
                            "path": "/config-server",
                            "backend": {
                                "serviceName": "config-server",
                                "servicePort": "config-port"
                            }
                        }

                    ]
                }
            }
        ]
    }
}
</code></pre>

<p>When, for example, I hit "<a href="http://IP/config-server" rel="nofollow noreferrer">http://IP/config-server</a>", because I have a basic auth on that service, the service does a redirect over "<a href="http://IP/login" rel="nofollow noreferrer">http://IP/login</a>" so I get a 404 but I was expecting "<a href="http://IP/config-server/login" rel="nofollow noreferrer">http://IP/config-server/login</a>". 
What is wrong with my configuration? I also tried "PathPrefix" and "Path" under rule type but it doesn't work. 
I need to keep my base path when my services perform redirects. </p>

Justin
<p>The issue here is that <code>PathPrefixStrip</code> removes <code>/config-server</code> and it initially forwards the request to your backend with just <code>/</code>. However, when your backend redirects it's a new request and the Ingress doesn't understand the request to <code>/</code> or <code>/login</code>. You could create two Ingress(es) for each backend and use single backend in each with a path to <code>/</code>. But this would mean adding a new ingress-class and <a href="https://github.com/containous/traefik/pull/3516" rel="nofollow noreferrer">the good news is that <code>Traefik</code> supports it</a>. You could also try <a href="https://kubernetes.github.io/ingress-nginx/user-guide/cli-arguments/" rel="nofollow noreferrer">an nginx</a> ingress which has the <code>--ingress-class</code> option.</p>

<p>You can find more information on how to create multiple ingress controllers <a href="https://github.com/nginxinc/kubernetes-ingress/tree/master/examples/multiple-ingress-controllers" rel="nofollow noreferrer">here</a></p>

<p>If you want a single Ingress it will also be tricky since you might have to add logic in your app to understand the <code>/config-server</code> path for example.</p>
