URI,URL和HTTP::uri

简介:
今天接到应用部门一个需求:
针对他们部门的某个URL:  [url]http://www.abc.com/[/url][url]https://www.abc.com/[/url]访问,需要直接跳到某一台主机上,而不希望在这个pool成员中轮询。而且正常的访问这个URL,需要跳转到 [url]https://www.abc.com/[/url],但是一些程序针对这个域名的接口调用则不需要跳转,一般的接口调用的URL最后为“.do”。
这个需求比较奇怪,考虑到一般人访问这个域名都是直接访问[url]www.abc.com[/url] 其实就是 [url]http://www.abc.com/[/url],而程序接口调用则类似为 [url]http://www.abc.com/[/url]*****.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.
                           ------摘自 [url]http://devcentral.f5.com/wiki/default.aspx/iRules/HTTP__uri.html[/url]
 
所以在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  https://[HTTP::host][HTTP::uri]
}
elseif { [HTTP::uri] contains "host1" } {
HTTP::redirect  https://[HTTP::host][HTTP::uri]
}
}
[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了。
}









本文转自 chris_lee 51CTO博客,原文链接:http://blog.51cto.com/ipneter/75492,如需转载请自行联系原作者

目录
相关文章
|
3月前
|
机器学习/深度学习 前端开发 JavaScript
源映射错误:Error: request failed with status 404 源 URL:http://localhost:8080/bootstrap/js/axios-0.18.0.js
源映射错误:Error: request failed with status 404 源 URL:http://localhost:8080/bootstrap/js/axios-0.18.0.js
50 0
源映射错误:Error: request failed with status 404 源 URL:http://localhost:8080/bootstrap/js/axios-0.18.0.js
|
2天前
|
网络协议 应用服务中间件 nginx
nginx 302 301 设置 url 转跳 nginx 资源重定向 nginx tcp 和 http 转发
nginx 代理后端网站,和 网站资源目录重定向到其他连接地址
22 3
|
1月前
|
数据采集 缓存 监控
HTTP与URL基础解析及简单示例实践
HTTP与URL基础解析及简单示例实践
|
2月前
|
网络协议 网络安全 API
Qt 网络编程之美:探索 URL、HTTP、服务发现与请求响应
Qt 网络编程之美:探索 URL、HTTP、服务发现与请求响应
54 1
|
2月前
|
Java 应用服务中间件
解决tomcat启动报错:无法在web.xml或使用此应用程序部署的jar文件中解析绝对的url [http:java.sun.com/jsp/jstl/core]
解决tomcat启动报错:无法在web.xml或使用此应用程序部署的jar文件中解析绝对的url [http:java.sun.com/jsp/jstl/core]
254 1
|
4月前
|
数据安全/隐私保护
URI 和URL 的区别是什么?
URI 和URL 的区别是什么?
|
5月前
|
PHP
URI和URL的区别
URI和URL的区别
|
6月前
|
JavaScript
HTTP header location 重定向 URL
HTTP header location 重定向 URL
|
7月前
|
前端开发 JavaScript 网络协议
HTTP初识,fiddler的使用,URL各部分介绍,QueryString
HTTP初识,fiddler的使用,URL各部分介绍,QueryString
|
7月前
Android-async-http 添加token get方法报错 No valid URI scheme was provided
Android-async-http 添加token get方法报错 No valid URI scheme was provided