i-rule redirection issue

Hi,

I have created a i-rule to redirect the when http host contains siteA, & uri starts with search, sent it to SiteA _3737pool.

if http host contains siteA, & uri has ‘sales’ or FinanceBuyCatergory’ words, it has to send request to pool Finance_443 .

Else send request to default pool SiteA_443.

Kindly check and let me know if i’m doing something wrong in logic. I see the request are not being send to backend pools .

Note: Pool SiteA is attached to VIP where as pool Finance is not attached to VIP and acting a independent pool.

irule:

if { [HTTP::host] eq “SiteA” and ([HTTP::uri] starts_with “/search/”) }{

SSL::disable serverside

pool SiteA_3737

}

elseif { [HTTP::host] eq “SiteA” } {

switch -glob [HTTP::uri] {

“*sales*” -

“*FinanceBuyCategory*” {

pool Finance_443

}

}

}

else { pool SiteA_443

}

}

you can achieve the same easily using LTM Traffic policy

Thank you,

LTM Traffic Policy is not enabled in F5 box.

Can you help on irule?

Hi T Rajneesh,

Can you try this iRule?

when HTTP_REQUEST {
	if { ([string tolower [HTTP::host]] equals "sitea.com") or ([string tolower [HTTP::host]] equals "www.sitea.com") } {
		switch -glob [string tolower [HTTP::uri]] {
			"/search/*" {
				log local0. "[HTTP::host] [HTTP::uri] iRule redirect SiteA_3737"
				SSL::disable serverside
				pool SiteA_3737
			}
			"*sales*" - 
			"*financebuycategory*" {
				log local0. "[HTTP::host] [HTTP::uri] iRule redirect Finance_443"
				pool Finance_443
			}
		}
	}
	
	log local0. "[HTTP::host] [HTTP::uri] iRule no redirect"
	# if you use default pool, no need 'pool SiteA_443'
	# pool SiteA_443
}

If it doesn’t work, can you check the logs?

HI,

My first rule is working fine. i.e., search one.

i have issue when uri has ‘sales’ or ‘FinanceBuyCatageroy’.

Regards,

Rajneesh