Forum Discussion
Ben_Wilson_2412
Cirrus
Jul 11, 2013Changing HTTP Reponse status code
Hi,
I've been asked to change the reponse HTTP Status code for custom 404 pages to "404" instead of 200.
It looks like this is possible by checking if the request is for /404.jsp, capturing...
nitass
Employee
Jul 12, 2013can we just check HTTP::status in response and send out 200?
e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.252:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b pool foo list
pool foo {
members 200.200.200.101:80 {}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_RESPONSE {
if { [HTTP::status] == 404 } {
HTTP::respond 200
}
}
}
test
[root@ve10:Active] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.18.204.228(49530) <-> 172.28.19.252(80)
1373588986.4110 (0.0048) C>S
---------------------------------------------------------------
GET /not_real_uri HTTP/1.1
Host: 172.28.19.252
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
---------------------------------------------------------------
New TCP connection 2: 200.200.200.10(49530) <-> 200.200.200.101(80)
1373588986.4121 (0.0010) C>S
---------------------------------------------------------------
GET /not_real_uri HTTP/1.1
Host: 172.28.19.252
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
---------------------------------------------------------------
1373588986.4132 (0.0010) S>C
---------------------------------------------------------------
HTTP/1.1 404 Not Found
Date: Fri, 12 Jul 2013 00:40:19 GMT
Server: Apache/2.2.3 (CentOS)
Content-Length: 288
Connection: close
Content-Type: text/html; charset=iso-8859-1
...snipped...
---------------------------------------------------------------
1373588986.4133 (0.0022) S>C
---------------------------------------------------------------
HTTP/1.0 200 OK
Server: BigIP
Connection: close
Content-Length: 0
---------------------------------------------------------------
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
