Forum Discussion
warren_beaudry_
Nimbostratus
Jul 26, 2013irule to load custom page via ifile when HTTP::status !200
Good day, DevCentral is an incredible resource but I thought I throw out my specific scenario for the community's opinion.
We're looking to load a "friendly" page via ifile to send to the...
nitass
Employee
Jul 27, 2013i understand you need HTTP::respond to send ifile content.
e.g.
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.20.111:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
myrule
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vlans-disabled
}
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm pool foo
ltm pool foo {
members {
200.200.200.101:80 {
address 200.200.200.101
}
}
}
root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm rule myrule
ltm rule myrule {
when HTTP_RESPONSE {
if { [HTTP::status] != 200 } {
HTTP::respond 200 content [ifile get simpletext_ifile] noserver
}
}
}
[root@ve11a:Active:Changes Pending] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.19.251(50701) <-> 172.28.20.111(80)
1374884126.3182 (0.0021) C>S
---------------------------------------------------------------
GET /fake 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: 172.28.20.111
Accept: */*
---------------------------------------------------------------
New TCP connection 2: 200.200.200.14(50701) <-> 200.200.200.101(80)
1374884126.3201 (0.0018) C>S
---------------------------------------------------------------
GET /fake 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: 172.28.20.111
Accept: */*
---------------------------------------------------------------
1374884126.3231 (0.0030) S>C
---------------------------------------------------------------
HTTP/1.1 404 Not Found
Date: Sat, 27 Jul 2013 00:12:18 GMT
Server: Apache/2.2.3 (CentOS)
Content-Length: 280
Content-Type: text/html; charset=iso-8859-1
404 Not Found
Not Found
The requested URL /fake was not found on this server.
Apache/2.2.3 (CentOS) Server at 172.28.20.111 Port 80
---------------------------------------------------------------
1374884126.3232 (0.0050) S>C
---------------------------------------------------------------
HTTP/1.0 200 OK
Connection: Keep-Alive
Content-Length: 25
this is new simple text.
---------------------------------------------------------------
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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