Redirect settings

kubernetes annotation of raefik.ingress.kubernetes.io/redirect-replacement and traefik.ingress.kubernetes.io/redirect-regex in any Should I have a relationship?

I was looking for a way to generate regex paths dynamically in this way on Traefik, and I thought it might be possible to generate them using these two.
I was looking for a way to generate these two in Traefik:https://github.com/reportportal/kubernetes/blob/master/reportportal/v5/templates/gateway-ingress.yaml#L23

What I want to do is to do something like this

You want to use the combination of rewrite-target and x-forwarded-prefix

Thanks

hi @yuzujoe,

If you want to apply some specific operation on your Ingress (like custom redirection), you have to use the traefik.ingress.kubernetes.io/router.middlewares annotation as describe in Ingress documentation and reference a redirectRegex middleware or any combination of needed middlewares.

Hi @jbd

Thank comment!!
I'm currently using Traefik v1.7. Do I need to upgrade to Traefik V2 to take advantage of this?

Am I wrong in thinking that I can expect similar results by using this area?

You have the redirection on the entry point on v1. It allows you to have a global redirection.
You can apply global redirection in the v2 with HTTP Options.

We encourage migration from v1 to v2 as the v1 is now in a maintenance stage, moreover, v2 adds useful features. :slight_smile:

I see.
Thank you very much.

I'm happy to report that I've tried many things since then and was able to achieve the same behavior with rewrite-target.

This is another answer I've gotten from my interactions with jbd, and I'm very grateful for it.

1 Like