Forum Discussion

Preet_pk's avatar
Preet_pk
Icon for Cirrus rankCirrus
Aug 14, 2023
Solved

URL redirection irule

Hi,

Please share below irule syntax for below URL redirection.

https://excample.com:9085/ldmcatalog/* to  https://excample.com/ldmcatalog/*

  • This solution Paulius shares here is 💯 as is, but for those looking for the slightest optimizations, you could swap out the HTTP::uri in the conditional and swap in HTTP::path, which will be a shorter comparison if there are any query parameters on the requests. Very minimal benefits, but if you obsess over every CPU cycle...

3 Replies

  • Preet_pk The following iRule should do what I believe you are describing above.

    when HTTP_REQUEST priority 500 {
    
        if {([HTTP::host] == "example.com:9085") && ([string tolower [HTTP::uri]] starts_with "/ldmcatalog/") } {
            HTTP::redirect "https://example.com[HTTP::uri]"
        }
    
    }
    • JRahm's avatar
      JRahm
      Icon for Admin rankAdmin

      This solution Paulius shares here is 💯 as is, but for those looking for the slightest optimizations, you could swap out the HTTP::uri in the conditional and swap in HTTP::path, which will be a shorter comparison if there are any query parameters on the requests. Very minimal benefits, but if you obsess over every CPU cycle...

  • Preet_pk - If your post was solved it would be helpful to the community to select *Accept As Solution*.
    This helps future readers find answers more quickly and confirms the efforts of those who helped.
    Thanks for being part of our community.
    Lief