Forum Discussion
Walter_WorkAcct
Apr 24, 2021Altostratus
Enes Afsin Al, thank you for the response and I do appreciate it but even changing that comparison only works on the default. For example, oldsite.ournewsite.net/foo goes to https://ournewsite.net/oldsitestuff instead of https://ournewsite.net/oldsitestuff/foo
- Apr 24, 2021
when HTTP_REQUEST { log local0. "oldsitelog1 | host = [HTTP::host] | uri = [HTTP::uri] | client_ip = [IP::client_addr]" if { [HTTP::host] equals "oldsite.ournewsite.net" } { switch -glob [HTTP::uri] { "*/foo" { log local0. "oldsitelog2 foo | uri = [HTTP::uri] | client_ip = [IP::client_addr]" HTTP::respond 301 Location https://ournewsite.net/oldsitestuff/foo return } "*/bar" { log local0. "oldsitelog3 bar | uri = [HTTP::uri] | client_ip = [IP::client_addr]" HTTP::respond 301 Location https://ournewsite.net/oldsitestuff/bar return } default { log local0. "oldsitelog4 default | uri = [HTTP::uri] | client_ip = [IP::client_addr]" HTTP::respond 301 Location https://ournewsite.net/oldsitestuff return } } } }
Can you investigate ltm logs?
tail -f /var/log/ltm | grep oldsitelog
- Rob_StonhamApr 25, 2021Cirrus
Hi
Looking at the iRule I'd check the position of the wildcard. Just reading it looks like it would only match URI's ending with "/foo" but I'd assume that you'd want to match where the URI starts with "/foo"