Forum Discussion
Allan_66523
Oct 19, 2011Nimbostratus
Irule Creation
Hi I am new to Irules and was wondering if someone could help me out. I am looking to create an I rule that does one of the following:
If a request comes into a VIP on the F5 without WWW (ex. f5.com) add www to the request then process and forward.
or
If a request comes into a VIP on the F5 without WWW (ex. f5.com) send to a different vip
Thanks in advance,
- nitassEmployeee.g.
[root@iris:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.17.33:http ip protocol tcp rules myrule profiles { http {} tcp {} } } [root@iris:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if {not ([string tolower [HTTP::host]] starts_with "www")} { HTTP::header replace Host "www.[HTTP::host]" } } } --------------------------------------------------------------- New TCP connection 1: 172.28.16.50(44422) <-> 172.28.17.33(80) 1319032099.4764 (0.0013) C>S --------------------------------------------------------------- HEAD / 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: abc.com Accept: */* --------------------------------------------------------------- New TCP connection 2: 10.10.72.30(44422) <-> 10.10.70.110(80) 1319032099.4769 (0.0003) C>S --------------------------------------------------------------- HEAD / 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.abc.com Accept: */*
[root@iris:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.17.33:http ip protocol tcp rules myrule profiles { http {} tcp {} } } [root@iris:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if {not ([string tolower [HTTP::host]] starts_with "www")} { virtual barbar } } } [root@iris:Active] config b virtual barbar list virtual barbar { snat automap pool foo destination 172.28.17.44:http ip protocol tcp } --------------------------------------------------------------- New TCP connection 1: 172.28.16.50(34836) <-> 172.28.17.33(80) 1319032322.1664 (0.0005) C>S --------------------------------------------------------------- HEAD / 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: abc.com Accept: */* --------------------------------------------------------------- New TCP connection 2: 172.28.16.50(34836) <-> 172.28.17.44(80) 1319032322.1665 (0.0000) C>S --------------------------------------------------------------- HEAD / 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: abc.com Accept: */* --------------------------------------------------------------- New TCP connection 3: 10.10.72.30(34836) <-> 10.10.70.110(80) 1319032322.1704 (0.0038) C>S --------------------------------------------------------------- HEAD / 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: abc.com Accept: */*
- Allan_66523NimbostratusWhich one of these options will be less resource intensive?
- nitassEmployeei don't know. LOL
- Allan_66523NimbostratusGreat, thanks for your help.
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