Chinaunix首页 | 论坛 | 博客

qsh

  • 博客访问: 3932863
  • 博文数量: 1015
  • 博客积分: 15904
  • 博客等级: 上将
  • 技术积分: 8572
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-04 19:16
文章分类

全部博文(1015)

文章存档

2019年(1)

2017年(1)

2016年(19)

2015年(27)

2014年(30)

2013年(95)

2012年(199)

2011年(72)

2010年(109)

2009年(166)

2008年(296)

分类: 系统运维

2012-02-22 10:44:48

http://www.cnitblog.com/lxq96/archive/2008/05/22/44129.html

今天接到应用部门一个需求:

针对他们部门的某个URL: 和访问,需要直接跳到某一台主机上,而不希望在这个pool成员中轮询。而且正常的访问这个URL,需要跳转到,但是一些程序针对这个域名的

接口调用则不需要跳转,一般的接口调用的URL最后为“.do”。

这个需求比较奇怪,考虑到一般人访问这个域名都是直接访问 其实就是,而程序接口调用则类似为*****.do。这就可以区分开来,在F5的定义中HTTP::uri表示HTTP::host后面的部分。

HTTP::uri
  • 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.

------摘自http://devcentral.f5.com/wiki/default.aspx/iRules/HTTP__uri.html

所以在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 "/" } {
HTTP::redirect

}
elseif { [HTTP::uri] contains "host1" } {
HTTP::redirect ]
}
}

[root@LB-1A-BIG6400:Active] root # b rule redirect_host1 list
rule redirect_host1 {
when HTTP_REQUEST {
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了。
}

阅读(1364) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~