Skip to content

Redirect Regex

The Redirect Regex middleware redirects a request using regex matching and replacement.

In the Regex field enter the capturing regex expression In the Replacement enter the URL to redirect to.

Creating the middleware on traefik

Edit your existing traefik install (or install fresh if you don’t have it installed)

  • Scroll down to redirectRegex

  • Click Add

  • Name: guacamole-redirect (Any name you want, remember it, you will need it later)

  • Regex: ^https://remote\.domain\.com/?$

  • Replacement: https://remote.domain.com/guacamole

  • Check Permanent

  • Click Save

    traefik-regex-redirect-fields

This will capture https://remote.domain.com or https://remote.domain.com/ and redirect it to https://remote.domain.com/guacamole

Applying the regex redirect middleware to the app

Edit your existing App, in this example we will use guacamole-client.

  • Scroll down to Traefik MIddlewares (Remember, you need to have ingress enabled)

  • Click Add

  • Name: guacamole-redirect (Replace with the name you gave to your middleware on the previous step)

  • Click Save

    traefik-regex-redirect-app

You are ready!