Forum Discussion
ukitsysadmin_95
Nimbostratus
Mar 19, 2010HTTP rewrite to specified nodes
Hello all,
Does anyone know how to write an irule for redirecting http requests to nodes in a pool.
I have a web farm of 10 servers all serving the same content, but I want a way to monitor each node is serving web pages correctly
currently, I have to change my host file 10 times to check each host is working
I tried to get this irule working without any success
what this should do, is if I type www.abc.com/node1 it should remove the /node1 and redirect www.abc.com onto server 1.1.1.72
when HTTP_REQUEST {
switch -glob [HTTP::path] {
/node1 {
Remove the /node1 prefix from the path
HTTP::path [string map -nocase {/node1 ""} [HTTP::path]]
Set the node
node 1.1.1.72 80
}
/node2 {
Remove the /node1/ prefix from the path
HTTP::path [string map -nocase {/node2 ""} [HTTP::path]]
Set the node
node 1.1.1.75 80
}
/node3 {
Remove the /node1/ prefix from the path
HTTP::path [string map -nocase {/node3 ""} [HTTP::path]]
Set the node
node 1.1.1.76 80
}
/node4 {
Remove the /node1/ prefix from the path
HTTP::path [string map -nocase {/node4 ""} [HTTP::path]]
Set the node
node 1.1.1.77 80
}
/node5 {
Remove the /node1/ prefix from the path
HTTP::path [string map -nocase {/node5 ""} [HTTP::path]]
Set the node
node 1.1.1.78 80
}
default {
Take some default action?
pool My_pool_80
}
}
}
also is there a way of logging, when someone enters www.abc.com/host1, it redirects to the correct node listed above
thanks in advance
- hoolio
Cirrostratus
Hi Mr Sysadmin,
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects