Forum Discussion

vikram_95579's avatar
vikram_95579
Icon for Nimbostratus rankNimbostratus
Jan 29, 2008

URL Redirect

Hello All,

 

I am new to iRule. Can someone help me with my problem of URL Redirect ?

 

 

Problem:

 

Source URL: http://sample.abc.com/sample/abc.dll?queryStr=sample&whoAreYou=Vikram

 

 

I want to redirect the URI containing 'sample/abc.dll' to another server and

 

redirect URL should be of something like this.

 

 

Target/Redirect URL: http://redirect.sample.abc.com/servlets/myProcessor?URL=http://sample.abc.com/sample/abc.dll?queryStr=sample&whoAreYou=Vikram

 

 

OR

 

Target/Redirect URL: http://redirect.sample.abc.com/servlets/myProcessor?queryStr=sample&whoAreYou=Vikram

 

 

 

Thanks,

 

Vikram

 

 

 

 

4 Replies

  • I am looking for kind of similar stuff. But is there a way to append even HTTP::uri also into Query String ?

     

     

    e.g.

     

    http://sample.abc.com/sample/abc.dll?queryStr=sample&whoAreYou=Vikram

     

     

    to

     

     

    http://redirect.sample.abc.com/servlets/myProcessor?URI=sample/abc.dll&queryStr=sample&whoAreYou=Vikram

     

     

    If this could not be done, I am fine with current one too.

     

     

     

     

    Thanks a lots,

     

    V

     

     

     

  • I am new in iRules, I have a problem and I want to know if F5 LTM 9.05 can do a redirec:

     

     

    I have these requests :

     

     

    http://upaapps.telcel.com:8381/portalwap.wml

     

    http://mitelcel.itelcel.com:8482/Portal/?a=1&o=1

     

    http://mitelcel.itelcel.com:7582/ideaswap/Portal?p=10&tc=3

     

    http://wap.telcel.com

     

     

    and I want to redirect those to below URL:

     

     

    http://mitelcel.itelcel.com:7015/PortalUMTS/UMTS/

     

     

    Thanks a regards
  • Hi eramosipn,

    It would be better to create a new post detailing what you're trying to do.

    If you want to redirect specific requests to a new URL, you can create an iRule which checks the requested URI and issues a redirect. Here is an example:

    
    when RULE_INIT {
        Log debug messages to /var/log/ltm? 1=yes, 0=no.
       set ::redirect_debug 1
    }
    when HTTP_REQUEST {
        Log the URI and path
       if {$::redirect_debug}{log local0. "Requested URI: [HTTP::uri], requested path: [HTTP::path]"}
        Check if the path is the one we're looking for
       if {[HTTP::path] eq /portalwap.wml}{
             if {$::redirect_debug}{log local0. "Redirecting client [IP::client_addr] "}
           Send a 302 redirect to the client
          HTTP::redirect http://mitelcel.example.com:7015/PortalUMTS/UMTS/
       }
    }

    You can check the wiki pages for the commands to get more detail:

    Events (Click here)

    HTTP_REQUEST (Click here)

    HTTP::uri (Click here)

    HTTP::path (Click here)

    HTTP::redirect (Click here)

    Aaron