event disable HTTP rewrite
Hi guys,
Currently migrating a legacy web application using Apache over to F5. Unfortunately, due to the nature of the application there are specific rewrites that need to occur so it works. Due to the way the web application works, the clients connect on their individual subdomains, which are then identified and rewritten in the HTTP header which gets sent to the backend server. I am able to get the users to connect to the initial landing page, but after they submit their details rather than getting sent to the next page the iRule executes again and sends users back to the landing page instead.
How I want it to work:
Client sees: a.domain.com > iRule > Internal server sees: domain.com/test/a
Client enters details, submits and then sees: a.domain.com/post > iRule > Internal server sees: domain.com/test/a/post
I figured I could get this working by utilising the event disable command and apply a second iRule to the VS which executes when data meets the conditions for a.domain.com/post. This isn't working as I expected, below are the iRules I've configured:
when HTTP_REQUEST {
set cust_id [getfield [HTTP::host] "." 1]
switch -glob [string tolower [HTTP::uri]] {
"*lib/*" {
HTTP::header "https://domain.com/lib/*"
}
"*static_pages/*" {
HTTP::header "https://domain.com/static_pages/*"
}
"*assets/*" {
HTTP::header "https://domain.com/assets/*"
}
default {
HTTP::header replace host [HTTP::host]
HTTP::uri "/client/$cust_id"
event disable
}
}
}
That is the first rule, it will take users to a page where they enter their details, they'll then do a POST that is meant to take them to:
when HTTP_REQUEST {
set cust_id [getfield [HTTP::host] "." 1]
switch -glob [string tolower [HTTP::uri]] {
"*lib/*" {
HTTP::header "https://domain.com/lib/*"
}
"*static_pages/*" {
HTTP::header "https://domain.com/static_pages/*"
}
"*assets/*" {
HTTP::header "https://domain.com/assets/*"
}
default {
HTTP::header replace host [HTTP::host]
HTTP::uri "/client/$cust_id/post"
event disable
}
}
}
What I'm seeing is the first rule executing even after I've specified the event disable command. Any advice on how to tackle this one?