Forum Discussion

ishhyd82's avatar
ishhyd82
Icon for Nimbostratus rankNimbostratus
Nov 01, 2019

Irule to redirect public ip to url

Hi Team,

 

Could you kindly advise for irule to redirect the public ip address to url name.

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    Care to elaborate your requirement a bit more?

  • Hi,

     

    We have a requirement to redirect the public ip address if we browse http:// 1.2.3.4 to be redirected to their domain website https://abc.com. I have tried with host in the irule but it didn't worked.

    • JG's avatar
      JG
      Icon for Cumulonimbus rankCumulonimbus

      Just trying to understand: Why would the user browse with an IP address rather than with a hostname? Would that be any IP address or do you have a specific IP address in mind?

  • There is specific IP Address and its a customer requirement, no issues with the domain website, customer wants with ip address as well & that's to be redirected to the URL website

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    If you know both the IP address and the hostname, then it would be something like the following:

    when HTTP_REQUEST {
        if { [HTTP::host] equals "1.2.3.4" } {
            HTTP::redirect "https://example.com[HTTP::uri]"
        }
    }

    .

  • Let me try above irule and will let you know & what about the redirection which i have configured for the url example.com to https://example.com whether i have to add any else condition if required.