Chinaunix首页 | 论坛 | 博客
  • 博客访问: 69168
  • 博文数量: 21
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 255
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-31 09:08
文章分类
文章存档

2008年(21)

我的朋友

分类: 系统运维

2008-06-03 23:42:08

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

针对他们部门的某个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了。
}

Google 标签: , , , ,

chris_lee 2008-05-22 21:54 发表评论
阅读(876) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~