Forum Discussion
nitass
Mar 07, 2013Employee
e.g.
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if { ( [HTTP::host] equals "subdomain.domain.com" ) and
( [scan [HTTP::path] {/%d/%d/%s} num1 num2 str] == 3 ) } {
HTTP::respond 301 noserver Location "http://domain.com/${num2}/"
log local0. "client [IP::client_addr]:[TCP::client_port] | origin host [HTTP::host] | origin uri [HTTP::uri] | num1 $num1 | num2 $num2 | str $str"
}
}
}
test
[root@ve10:Active] config curl -I http://subdomain.domain.com/1050/38745/productdata-reviews/reviews.htm
HTTP/1.0 301 Moved Permanently
Location: http://domain.com/38745/
Connection: Keep-Alive
Content-Length: 0
[root@ve10:Active] config curl -I http://subdomain.domain.com/1050/346687/otherproductdata-reviews/reviews.htm
HTTP/1.0 301 Moved Permanently
Location: http://domain.com/346687/
Connection: Keep-Alive
Content-Length: 0
log
[root@ve10:Active] config tail -f /var/log/ltm
Mar 8 08:08:14 local/tmm info tmm[22185]: Rule myrule : client 172.28.19.253:42841 | origin host subdomain.domain.com | origin uri /1050/38745/productdata-reviews/reviews.htm | num1 1050 | num2 38745 | str productdata-reviews/reviews.htm
Mar 8 08:08:34 local/tmm info tmm[22185]: Rule myrule : client 172.28.19.253:42842 | origin host subdomain.domain.com | origin uri /1050/346687/otherproductdata-reviews/reviews.htm | num1 1050 | num2 346687 | str otherproductdata-reviews/reviews.htm