Forum Discussion
t-roy
Nov 22, 2011Nimbostratus
inserting X-Origin-Host heade when using catch command
iRule's purpose:
rewrite some URIs to /
rewrite some hosts to start with www
send some URIs to my non-default pool but putting them in a data-group like "foo" := "foopool",
My prob...
nitass
Nov 23, 2011Employee
e.g.
[root@ve1023:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve1023:Active] config b pool foo list
pool foo {
members 200.200.200.101:80 {}
}
[root@ve1023:Active] config b pool foopool list
pool foopool {
members 200.200.200.102:80 {}
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if {[class match -- [string toupper [HTTP::host]] starts_with WWW-PREIMP.FOO.CA-PATHREDIR]} {
HTTP::respond 301 Location "http://www.[HTTP::host]"
} elseif {[class match -- [string toupper [HTTP::uri]] starts_with WWW-PREIMP.FOO.CA-URIREDIR]} {
HTTP::uri "/"
}
if {[class match -- [string toupper [HTTP::uri]] starts_with FOO.CA-REDIR]} {
catch {HTTP::header insert lws X-Origin-Host [HTTP::host]}
catch {pool [class match -value [string toupper [HTTP::uri]] starts_with FOO.CA-REDIR]}
}
}
}
[root@ve1023:Active] config b class WWW-PREIMP.FOO.CA-PATHREDIR list
class WWW-PREIMP.FOO.CA-PATHREDIR {
"ABC.COM"
}
[root@ve1023:Active] config b class WWW-PREIMP.FOO.CA-URIREDIR list
bclass WWW-PREIMP.FOO.CA-URIREDIR {
"/TEST"
}
[root@ve1023:Active] config b class FOO.CA-REDIR list
class FOO.CA-REDIR {
"/FOO" { "foopool" }
}
1
[root@ve1023:Active] config curl -I http://abc.com/abc
HTTP/1.0 301 Moved Permanently
Location: http://www.abc.com
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
2
[root@ve1023:Active] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.19.253(45755) <-> 172.28.19.79(80)
1322048483.6894 (0.0031) C>S
---------------------------------------------------------------
HEAD /test/abc HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8r zlib/1.2.3 libidn/0.6.5
Host: www.abc.com
Accept: */*
---------------------------------------------------------------
New TCP connection 2: 200.200.200.10(45755) <-> 200.200.200.101(80)
1322048483.6904 (0.0009) C>S
---------------------------------------------------------------
HEAD / HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8r zlib/1.2.3 libidn/0.6.5
Host: www.abc.com
Accept: */*
---------------------------------------------------------------
3
[root@ve1023:Active] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.19.253(47562) <-> 172.28.19.79(80)
1322048588.1531 (0.0019) C>S
---------------------------------------------------------------
HEAD /foo/abc HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8r zlib/1.2.3 libidn/0.6.5
Host: www.abc.com
Accept: */*
---------------------------------------------------------------
New TCP connection 2: 200.200.200.10(47562) <-> 200.200.200.102(80)
1322048588.1553 (0.0010) C>S
---------------------------------------------------------------
HEAD /foo/abc HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8r zlib/1.2.3 libidn/0.6.5
Host: www.abc.com
Accept: */*
X-Origin-Host: www.abc.com
---------------------------------------------------------------
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects