Forum Discussion

Chi_Kee_254058's avatar
Chi_Kee_254058
Icon for Nimbostratus rankNimbostratus
Feb 09, 2018

HTTP:redirect iRule

Can you please help me to know if this iRule will help me accomplish my current requirements:

 

----redirects to--->

 

Along with a set of accompanying iRules that ensure this redirect WILL NOT interfere with requests for these specific URLs, allowing requests to land on the current location (company_pool):

 

--lands--> /help on poolmember of company_pool --lands--> /about on poolmember of company_pool --lands--> /support on poolmember of company_pool --lands--> /profile on poolmember of company_pool

 

Here is the iRule: We want to ensure too (1) that lower/uppercase too should not be an issue and (2) that using an "equals" will not have an issue when passing traffic from subfolders of subfolders path.

 

when HTTP_REQUEST { if { [HTTP::uri] equals "/help" } {

 

pool company_pool } elseif { [HTTP::uri] equals "/contact" } { pool company_pool } elseif { [HTTP::uri] equals "/support" } { pool company_pool } elseif { [HTTP::uri] equals "/profile" } { pool company_pool } } else { HTTP:redirect "; } }

 

1 Reply

  • if you want that subfolders of /help also matches, you have to replace

    if { [HTTP::uri] equals "/help" } 
    

    by

    if { [HTTP::uri] starts_with "/help" }  
    

    there is a curly bracket you have to remove before the last else.