今天接到應用部門一個需求:
Returns the URI of the request. It does not include the protocol (http or https) or hostname, just the path, starting with the slash after the hostname.
是以在LTM上面寫下如此irule:
[root@LB-1A-BIG6400:Active] root #b rule http_https_host1 list
rule http_https_host1 {
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
}
elseif { [HTTP::uri] contains "host1" } {
和
[root@LB-1A-BIG6400:Active] root # b rule redirect_host1 list
rule redirect_host1 {
if { [HTTP::uri] ends_with "host1" } {
use node a.b.c.d 80
然後将http_https_host1用在80的virtual server上,而将redirect_host1用在443的virtual server上就ok了。
本文轉自 chris_lee 51CTO部落格,原文連結:http://blog.51cto.com/ipneter/75492,如需轉載請自行聯系原作者