Forum Discussion

Mouene_240365's avatar
Mouene_240365
Icon for Nimbostratus rankNimbostratus
Jan 21, 2017

URL rewriting

Hi, I am redirecting a request using iRule from inside my network to the Internet , in the iRule I am using public ip address of my public server , the url appear to all users like the following: /HomePage/index.html how to replace this Public IP-address with a name , for some reasons I can't use the original name, I want to be like this /HomePage/index.html is it possible or not. Regards,

 

4 Replies

  • Sorry I meant to be like this -->> name/HomePage/index.html This is what I am curenlty using:

     

    when HTTP_REQUEST { HTTP::redirect }

     

  • This might be what you need (the requirements weren't very clear);-

    when HTTP_REQUEST {
        if {[HTTP::path] eq "/"} {
            HTTP::respond 301 Location "http://[HTTP::host]/HomePage/index.html" 
            return
        }
    }
    
    • Mouene_240365's avatar
      Mouene_240365
      Icon for Nimbostratus rankNimbostratus

      Thank you for your reply , unfortunately this does not answer my question. I have the following iRule : when HTTP_REQUEST { HTTP::redirect } This iRule redirect users to the Internet , the public IP address that I used in this iRuel appears in the url in the browser after redirecting ex.:

       

      My questin is how to hide this ip or replace it with any other name to be like the following:

       

      Thanks,

       

    • IheartF5_45022's avatar
      IheartF5_45022
      Icon for Nacreous rankNacreous

      Is this what you need? Sorry still unclear on requirement.....

      when HTTP_REQUEST {
          if {!([HTTP::Host] eq "anyname.com")} {
              HTTP::respond 301 Location "http://anyname.com/HomePage/index.html" 
              return
          }
      }