Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

268
Views
Kubernetes Ingress Redirect and Rewrite

quick question as I am sure its an easy fix, just cannot seem to figure it out!

We have a site that runs on www.awesomeapp.com - all working perfectly on ingress routing

However I want to also redirect the route domain to www.awesomeapp.com for example awesomeapp.com => www.awesomeapp.com

I added this annotation nginx.ingress.kubernetes.io/permanent-redirect: https://www.awesomeapp.com

Again all working perfectly.

My question is how do I also get the path added as well. For example

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

www.blahblah.com/myawesomepage

I added this ingress.kubernetes.io/rewrite-target: /$1$2 but this does not work, and that is in conjunction with this - path: /(/|$)(.*)

Full yaml config as follows:

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

Thanks John

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!