V2 migration: redir

Hi,

we migrated from V1 to V2 and it really worked out nice. I am only unable to convert the redir to V2, it only ends up in an loop.

host.xyz.com  {

..

    redir 302 {
     if {path} is /
      / /devcon/check_mk/
    }

    reverse_proxy http://192.168.2.156:5000 {
    }
}

if does not exist in Caddy v2. Instead, you must use request matchers for conditions:

The redir directive takes an optional matcher as the first argument, then the path to redirect to, then the status code.

Next time, please fill out the help topic template when asking questions on the forums.

1 Like

Awesome, thanks.

Solved via:

redir / /devcon/check_mk 302

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.