Forum Discussion

PeterC_70986's avatar
PeterC_70986
Icon for Nimbostratus rankNimbostratus
Mar 01, 2019

irule redirect based on URI does not work if there are numbers in it

I have an irule that is redirecting based on the URI. If one of the levels in the path is all numbers, the redirect does not work. If I shorten the URI and remove the numbers, the redirect works. The problem is we need a more specific URI to trigger the redirect. Do I need to put something before and after the number in the URI?

 

when HTTP_REQUEST { if {[HTTP::uri] contains "whatever/12345/something" } { HTTP::redirect "https://www.abc.com[HTTP::uri]" } }

 

  • Which TMOS version are you on?

    I just tested that iRule out in my home lab and it was working fine

    iRule

    root@(localhost)(cfg-sync Standalone)(Active)(/Common)(tmos) list ltm rule REDIRECT
    ltm rule REDIRECT {
    when HTTP_REQUEST {
        if { [HTTP::uri] contains "whatever/12345/something" } {
            HTTP::redirect "https://www.abc.com[HTTP::uri]" }
        }
    }
    

    cURL Verification

    $ curl -IL http://192.168.1.100/whatever/12345/something
    HTTP/1.0 302 Moved Temporarily
    Location: https://www.abc.com/whatever/12345/something
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0