Forum Discussion

msaud's avatar
Icon for Cirrus rankCirrus
Apr 22, 2024

F5 iRule to replace host to path

Hi Team,

Can someone please help me to create iRule to  achieve below requirement.


I have created one VS " vs_mule-dev-azure-lb.ucsf.edu_443 and want to route the traffic as below ---> --->



4 Replies

  • Hi msaud,

    Can you test the iRule?

    when HTTP_REQUEST {
        if { [HTTP::host] eq "" && [getfield [HTTP::path] "/" 3] eq "api" } {
            HTTP::redirect "https://[getfield [HTTP::path] "/" 2][getfield [HTTP::uri] [getfield [HTTP::path] "/" 2] 2]"


      • SanjayP's avatar
        Icon for Nacreous rankNacreous

        Do you need rewrite on the serverside session or redirect on the clientside (visible in the browser)?. iRule will change depending on the exact requirement.