Forum Discussion

Rajendran2002_1's avatar
Rajendran2002_1
Icon for Nimbostratus rankNimbostratus
Jul 24, 2015

Assistance in Irule

Hi

 

Am new to irule and need assistance for below http redirect

 

when user enter http://learning.abc.com it should redirect to http://inside.abc.com/learn and also when user enter

 

http://learning.abc.com/default.aspx?OriginalURL=/geonext/coursesummary.CourseCatalog.geo?id=22507103497&selectTab=Scheduled+Classes

 

it should be redirect like below with first uri match

 

http://inside.abc.com/learn/default.aspx?OriginalURL=/geonext/coursesummary.CourseCatalog.geo?id=22507103497&selectTab=Scheduled+Classes

 

host and first uri should match in redirection

 

I used below irule, it works for first redirection but not the other one

 

when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "learning.abc.com" } { HTTP::redirect "http://inside.abc.com/Learn" } }

 

  • Try a minor modification:

    when HTTP_REQUEST { 
        if { [string tolower [HTTP::host]] equals "learning.abc.com" } { 
            HTTP::redirect "http://inside.abc.com/learn[HTTP::uri]" 
        } 
    }
    

    This will add the requested URI to the end of the redirect URI. If nothing is requested (no URI), then the minimum will be "/", as in

    http://inside.abc.com/learn/