Forum Discussion
dyobbs_25515
Feb 03, 2012Nimbostratus
iRule to redirect a variable to http
Guys hi,
I'm newbie here. I wanted to create an iRule, that truncates the later part of the message from the "http://.acme.com" to http://
any help is appreciated.
Will t...
nitass
Feb 13, 2012Employee
it is because header is different when requesting directly and using explicit proxy.
this is directly request.
[root@ve1023:Active] config ssldump -Aed -nni 0.0 port 80
Feb 13 02:26:36 local/tmm notice tmm[4822]: 013e0001:5: Tcpdump starting bcast on :::0 from 127.1.1.1:34917
New TCP connection 1: 172.28.19.251(45151) <-> 172.28.19.79(80)
1329128801.9948 (0.0009) C>S
---------------------------------------------------------------
HEAD /whatever HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Accept: */*
Host: www.yahoo.com.acme.com.nz
---------------------------------------------------------------
this is request with f5 as an explicit proxy.
[root@ve1023:Active] config ssldump -Aed -nni 0.0 port 80
Feb 13 02:27:30 local/tmm notice tmm[4822]: 013e0001:5: Tcpdump starting bcast on :::0 from 127.1.1.1:57671
New TCP connection 1: 172.28.19.251(45152) <-> 172.28.19.79(80)
1329128868.8840 (0.0012) C>S
---------------------------------------------------------------
HEAD http://www.yahoo.com.acme.com.nz/whatever HTTP/1.1
User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Host: www.yahoo.com.acme.com.nz
Pragma: no-cache
Accept: */*
Proxy-Connection: Keep-Alive
---------------------------------------------------------------
this is an example irule when using f5 as an explicit proxy.
[root@ve1023:Active] config b virtual bar list
virtual bar {
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
set proxy_uri [string tolower [HTTP::uri]]
set uri [getfield $proxy_uri $host 2]
set newhost [string map {".acme.com.nz" ""} $host]
if {$host ne $newhost} {
HTTP::redirect "http://$newhost$uri"
}
}
}
[root@ve1023:Active] config curl -I http://www.yahoo.com.acme.com.nz/whatever -x 172.28.19.79:80
HTTP/1.0 302 Found
Location: http://www.yahoo.com/whatever
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
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