Forum Discussion

Sulabh_Srivasta's avatar
Feb 04, 2025

Need assistance on iRule or policy to redirect

Hello All,

 

Please assist me either using the iRule or policy for the following requirement where the URI www.abc.com/mywork/variable?REQUEST=Getfiles/ should redirect to www.abc.com/capfiles/variable.xml

AND www.abc.com/mywork/xxxx/yyyy/  should add the URI path to www.abc.com/PRQS/LMN/mywork/xxxx/yyyy/

The variable keeps changing. Tried couple of iRule but not working.

Any help will be greatly appreciated.

Thanks

  • Sulabh_Srivasta The second redirect should work with the following iRule but your first one will not work because the F5 doesn't see anything beyond the "?" in the URI.

    when CLIENT_ACCEPTED priority 500 {
    
        set DEFAULT_POOL [LB::server pool]
    
    }
    
    when HTTP_REQUEST priority 500 {
    
        set HOST [string tolower [HTTP::host]]
        set URI [string tolower [HTTP::uri]]
    
        if { ${HOST} eq "www.abc.com"} {
            if {${URI} starts_with "/mywork/"} {
                HTTP::uri [string map {"/mywork/" "/PRQS/LMN/mywork/"}[HTTP::uri]]
            }
        } else {
            pool $DEFAULT_POOL
        }
    
    }

     

    • Thanks for you response,  I need a redirect rule/policy for the first one as well. 

      • Paulius's avatar
        Paulius
        Icon for MVP rankMVP

        The first one can't have one for the reason I outlined in my comment above.