Forum Discussion
hu_127869
Dec 16, 2005Historic F5 Account
How to rewrite the status from 205 to 200
Hi :
I would like to rewrite http status code 205 to 200. I try to use http:respond 200 , However, the payload is erased , Any good sample for me to rewrite the status code and also keep my original content/header. Thanks !
- bl0ndie_127134Historic F5 AccountHmm good question! Unfortunately for some reason our HTTP developer did not provide any way to change the response code, but that does not mean you can’t do it. There are a couple of approaches to this problem.
when HTTP_RESPONSE { if {[HTTP::status] == 205}{ HTTP::collect [HTTP::header Content-Length] } } when HTTP_RESPONSE_DATA { HTTP::respond 200 content [HTTP::payload] }
- hu_127869Historic F5 AccountThanks for your help. However ,the bad thing is that server do not write the content-length information in the header .
- hu_127869Historic F5 AccountI have a rule like this , It works sometimes , however, sometime do not , And got an error in /var/log/ltm like this
- bl0ndie_127134Historic F5 AccountHow about some thing like this. It appears to work for me.
when HTTP_REQUEST_SEND { TCP::collect 12 } when SERVER_DATA { if {[findstr [TCP::payload 12] "200"] == "200"} { TCP::payload replace 9 3 "205" } }
- bl0ndie_127134Historic F5 AccountNote that I have the response codes logic reversed but it should still demonstrate the point.
- unRuleY_95363Historic F5 AccountYou shouldn't need the "TCP::collect 100" in the SERVER_DATA event.
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