Forum Discussion
4 Replies
This is pretty straightforward. You can do something like:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/norwoodwsconfigbridge/norwoodwsconfigbridgeuri" } { HTTP::respond 301 Location "https://205.157.77.42:7002" } elseif { [string tolower [HTTP::uri]] starts_with "/psigw/peoplesoftservice" } { HTTP::respond 301 Location "https://205.157.77.43:7000" } }
FYI, this isn't tested, please run your checks before implementing in a production mode.
- Kevin_StewartEmployee
Try this:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/norwoodwsconfigbridge/norwoodwsconfigbridgeuri*" { node 205.157.77.42 7002 } "/psigw/peoplesoftservice*" { node 205.157.77.43 7000 } default { pool local-pool } } }
where "local-pool" is a pool to send traffic to if the request URI doesn't match either of the previous conditions.
I just noticed that you said node for the redirect. Using samples from: iRules 101 - 05 - Selecting Pools, Pool Members, and Nodes
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/norwoodwsconfigbridge/norwoodwsconfigbridgeuri" } { pool MYPOOL member 205.157.77.42 7002 } elseif { [string tolower [HTTP::uri]] starts_with "/psigw/peoplesoftservice" } { pool OTHERPOOL member 205.157.77.43 7000 } }
(edited for case issues)
- Kevin_StewartEmployee
What is the difference between the to I rules you guys posted?
The node command sends to a specific node, regardless of pool membership, while the pool command, specifically pool [pool name] member [IP] [port] sends traffic to a specific pool member, which must exist in the pool. In my opinion, using the node command is really no better or worse than using the pool member command. They're both targeting a specific service regardless of any load balancing or health status. You didn't mention a pool configuration, so I went with the node option.