# Setting up Middleware redirectRegex within kubernetes

**URL:** <https://community.traefik.io/t/setting-up-middleware-redirectregex-within-kubernetes/20086>\
**Category:** Traefik v2\
**Tags:** kubernetes-crd, middleware\
**Created:** [October 5, 2023, 4:52pm UTC](https://community.traefik.io/t/setting-up-middleware-redirectregex-within-kubernetes/20086 "2023-10-05T16:52:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jean-Philippe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/jean-philippe/32/7688_2.png) [@Jean-Philippe](https://community.traefik.io/u/Jean-Philippe)\
**Post date:** [October 5, 2023, 4:52pm UTC](https://community.traefik.io/t/setting-up-middleware-redirectregex-within-kubernetes/20086/1 "2023-10-05T16:52:28Z")

</div>

Hello,

I have this middleware :

```auto
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: redirect
spec:
  redirectRegex :
    permanent: true
    regex: "^https://some.domain.com(.*)"
    replacement: "https://otherdomain.com"

```

and this IngressRoute:

```auto
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: traefik-app
spec:
  tls:
    secretName: {{ .Values.tlsSecret }}
    domains:
    - main: domain.com
  entryPoints:
    - entrypoint-https
  routes:
  - kind: Rule
    match: Host(`some.domain.com`)
    middlewares:
      - name: redirect
    services:
    - name: noop
   ...other working rules...

```

All my rules are working fine except the redirect regex.

When I try to navigate expecting the redirection, I got 404.  
And on the dashboard, I don't see my rule, I don't know what I'm doing wrong.

---

<div class="post-metadata">

**Author:** ![Jean-Philippe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/jean-philippe/32/7688_2.png) [@Jean-Philippe](https://community.traefik.io/u/Jean-Philippe)\
**Post date:** [October 5, 2023, 6:30pm UTC](https://community.traefik.io/t/setting-up-middleware-redirectregex-within-kubernetes/20086/2 "2023-10-05T18:30:24Z")

</div>

Ok I needed to point an existing service even if I don't use it.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [October 8, 2023, 6:31pm UTC](https://community.traefik.io/t/setting-up-middleware-redirectregex-within-kubernetes/20086/3 "2023-10-08T18:31:12Z")

</div>

Closed on October 8, 2023, 6:31pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
