Forum Discussion
irule and httpclass profile - what takes precedence?
In a VIP, i have added an irule-redir1 and httpclass-redir1 profile. Which one take precedence?
irule-redir1 has this:
when HTTP_REQUEST {
if { [HTTP::header exists "Authorization"] } {
if { [active_members POOLK_443] >= 1 } {
pool POOLK_443
}
}
}
httpclass-redir1 has this:
URI Path match /test99
Send to pool POOLK_443
rewrite URI: /
Could anyone explain would irule be executed first then httpclass is executed or NOT?
Also, i would like to rewrite the URI with httpclass from https://xyz.com/test99 to https://xyz.com/test/index.asp
Thanks,
4 Replies
- Michael_Yates
Nimbostratus
Hi navgup,
I believe that the iRule events would fire first. You can see from the Master List of iRule Events that you can detect an HTTP_CLASS_FAILED(no qualifying HTTP Class Found) and HTTP_CLASS_SELECTED and individual triggers for an iRule Event.
Depending on what you are doing in the HTTP Class or the iRule, some events may or may not process.
Hope this helps. - nitass
Employee
httpclass matching happens after HTTP_REQUEST.
i would like to rewrite the URI with httpclass from https://xyz.com/test99 to https://xyz.com/test/index.aspe.g.[root@ve10:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.252:80 ip protocol 6 httpclass myhttpclass profiles { http {} tcp {} } } [root@ve10:Active] config b profile myhttpclass list profile httpclass myhttpclass { defaults from httpclass pool none redirect none url rewrite "/test/index.asp" paths "/test99" } New TCP connection 1: 172.28.20.17(51118) <-> 172.28.19.252(80) 1375757739.1186 (0.0011) C>S --------------------------------------------------------------- GET /test99 HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.252 Accept: */* --------------------------------------------------------------- New TCP connection 2: 200.200.200.10(51118) <-> 200.200.200.101(80) 1375757739.1215 (0.0010) C>S --------------------------------------------------------------- GET /test/index.asp HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.252 Accept: */* --------------------------------------------------------------- - navgup_66025
Nimbostratus
that helps, but it doesnot change the url on the browser and the pool is not selected.
Is there a way to select a pool POOLK_443 if /test99 is in the URI and Redirect the URL to /test/index.asp?
thanks - nitass
Employee
but it doesnot change the url on the browser and the pool is not selected.that could be redirection rather than rewriting.
Redirects, Rewrites and App Transfers via iRules by Colin Walker
https://devcentral.f5.com/tech-tips/articles/redirects-rewrites-and-app-transfers-via-irules.UgB14m0-YdU
e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.252:80
ip protocol 6
httpclass {
redirect-class
pool-class
}
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b pool foo list
pool foo {
members 200.200.200.101:80 {}
}
[root@ve10:Active] config b pool qux list
pool qux {
members 200.200.200.111:80 {}
}
[root@ve10:Active] config b profile redirect-class list
profile httpclass redirect-class {
redirect "/test/index.asp"
paths "/test99"
}
[root@ve10:Active] config b profile pool-class list
profile httpclass pool-class {
defaults from httpclass
pool qux
redirect none
paths "/test/index.asp"
}
test
[root@ve10:Active] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.20.17(51134) <-> 172.28.19.252(80)
1375761422.0567 (0.0010) C>S
---------------------------------------------------------------
HEAD /test99 HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Host: 172.28.19.252
Accept: */*
---------------------------------------------------------------
1375761422.0569 (0.0001) S>C
---------------------------------------------------------------
HTTP/1.0 302 Found
Location: /test/index.asp
Connection: Keep-Alive
Content-Length: 0
---------------------------------------------------------------
1375761422.0584 (0.0015) C>S
---------------------------------------------------------------
HEAD /test/index.asp HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Host: 172.28.19.252
Accept: */*
---------------------------------------------------------------
New TCP connection 2: 200.200.200.10(51134) <-> 200.200.200.111(80)
1375761422.0605 (0.0010) C>S
---------------------------------------------------------------
HEAD /test/index.asp HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Host: 172.28.19.252
Accept: */*
---------------------------------------------------------------
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com