contour: Redirect: adding a redirect (301 or 302) option in ingressroute / httpproxy

Describe the solution you’d like The ingressroute / httpproxy should be able to support a match and then redirect with either a 301 or 302 to an http or https destination

Something like:

spec:
  routes:
  - match: /
    services:
    - name: awesome-service-01
      port: 1000
   - match: /redirectpath
    redirect:
      method: 301
      destination: https://externalawesomewebsite.com
  virtualhost:
    fqdn: awesomehost.tld

Anything else you would like to add: The use case would be that for example if you have a website pointed to the ingress you can now also do redirects in contour. This would prevent you from having to spin up another container inside for the redirect (nginx for example).

Environment:

  • Contour version: v1.0.0-beta.1
  • Kubernetes version: (use kubectl version): v1.14.6-gke.1
  • Kubernetes installer & version: N/A (Google)
  • Cloud provider or hardware configuration: GKE
  • OS (e.g. from /etc/os-release): GKE

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 11
  • Comments: 18 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you for your feature request. I think I understand the use case. At the moment we’re deep in feature freeze in preparation for Contour 1.0. I’ve assigned this to the backlog for prioritisation for a future release.

We’ve already got it for Gateway API: https://github.com/projectcontour/contour/pull/4123

This would be nice for dealing with redirecting 'example.comtowww.example.comor vice-versa. Currently, I'm running an nginx container whose only job is to redirect all requests towww.example.com`.