Forum Discussion
Wil_Schultz_101
Feb 28, 2012Nimbostratus
Need to change the HTTP Status code.
I have a maintenance page sitting on some servers, if all goes awry traffic is pointed at this page. I'd like to ba able to swap the status from HTTP 200 to HTTP 503. Can't seem to figure out a good way to do this using an iRule.
Is there a way other than using HTTP:collect and then HTTP:respond?
- hooleylistCirrostratusHi Wil,
- Wil_Schultz_101NimbostratusHrm, ran into some TCL variable size issues that I'd really like to never see again so I'm hesitant about using HTTP::collect right about now. 11.1 has some nice new features, also seems to have a few "undocumented features" as well.
- spark_86682Historic F5 AccountIf I understand you correctly, you're trying to sometimes alter the HTTP status code of a response passing through the BIG-IP. You could just do this at the TCP level and bypass all of the messing about at the HTTP layer altogether. Something like (totally untested):
when SERVER_CONNECTED { if { $should_alter_response_status } { TCP::collect 12 } } when SERVER_DATA { set payload [TCP::payload 12] regsub 200 $payload 503 payload TCP::payload replace 0 12 $payload TCP::release }
- hooleylistCirrostratusNice idea Spark. But you'd need to parse every response in TCP to check if you need to rewrite the response code. And it would get interesting trying to handle serverside connection reuse.
- spark_86682Historic F5 AccountWell, the whole point of this approach would modify the data before the HTTP profile sees it, so you could still have an HTTP profile and have it do all the parsing. It does make the assumption that the HTTP server is well-behaved, though. Connection reuse does get interesting, but I think if you close the connection after doing a rewrite in this fashion that that will work.
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