<p>quick question as I am sure its an easy fix, just cannot seem to figure it out!</p>
<p>We have a site that runs on <a href="http://www.awesomeapp.com" rel="nofollow noreferrer">www.awesomeapp.com</a> - all working perfectly on ingress routing</p>
<p>However I want to also redirect the route domain to <a href="http://www.awesomeapp.com" rel="nofollow noreferrer">www.awesomeapp.com</a> for example awesomeapp.com =&gt; <a href="http://www.awesomeapp.com" rel="nofollow noreferrer">www.awesomeapp.com</a></p>
<p>I added this annotation
nginx.ingress.kubernetes.io/permanent-redirect: <a href="https://www.awesomeapp.com" rel="nofollow noreferrer">https://www.awesomeapp.com</a></p>
<p>Again all working perfectly.</p>
<p>My question is how do I also get the path added as well. For example</p>
<p>user enters in awesomeapp.com/myawesomepage and what I want is it to not only redirect but append the path as well so it ends up like this</p>
<p><a href="http://www.blahblah.com/myawesomepage" rel="nofollow noreferrer">www.blahblah.com/myawesomepage</a></p>
<p>I added this ingress.kubernetes.io/rewrite-target: /$1$2 but this does not work, and that is in conjunction with this - path: /(/|$)(.*)</p>
<p>Full yaml config as follows:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:  
    name: root-routing
    labels:
      app: awesomeapp
    annotations:
        kubernetes.io/ingress.class: nginx     
        nginx.ingress.kubernetes.io/permanent-redirect: https://www.awesomeapp.com
        ingress.kubernetes.io/rewrite-target: /$1$2
spec:
    tls:
    - hosts:
        - awesomeapp.com
      secretName: awesomeapp-com-tlscert
    rules:
    - host: awesomeapp.com
      http:
        paths:
        - path: /(/|$)(.*)
          pathType: Prefix
          backend:
            service:
                name: awesomeapp
                port:
                    number: 80
</code></pre>
<p>Thanks
John</p>

<p>nginx.ingress.kubernetes.io/server-snippet: |
return 301 https://www.awesomeapp.com$request_uri;</p>
