Redirect in Traefik from one domain to another : <p>According to the <a href="https://github.com/containous/traefik/blob/master/docs/configuration/backends/kubernetes.md" rel="noreferrer">documentation</a> you should be able to have Traefik perform a 302 redirect using:</p>

<ul>
<li><code>traefik.ingress.kubernetes.io/redirect-regex</code></li>
<li><code>traefik.ingress.kubernetes.io/redirect-replacement</code></li>
</ul>

<p>My goal is to simply remove the <code>www.</code> from the address.</p>

<p>This is what I've tried, but I get a 404 service not found.</p>

<pre><code>---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: www-redirect
  namespace: public
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.ingress.kubernetes.io/redirect-regex: ^https?://www.example.com/(.*)
    traefik.ingress.kubernetes.io/redirect-replacement: https://example.com/$1
spec:
  rules:
  - host: www.example.com
</code></pre>

<p>Unfortunately the documentation isn't explicit on <em>how</em> to use them. At the time of writing the only google hit on this is the documentation (above). </p>

<p>My current work around (assuming it'll help explain the question) is to route <code>www.</code> traffic to nginx which returns a 302.</p>

<pre><code>server {
    listen       80;
    server_name  www.example.com;
    return 302 https://example.com$request_uri;
}
</code></pre>

<p>This seems like overkill.</p>


