Forum Discussion

ramann_75062's avatar
ramann_75062
Icon for Nimbostratus rankNimbostratus
Jan 25, 2008

Change Response Code

Hi @all,

 

 

is the a way to change the resonse code from a web server?

 

 

For example:

 

 

The Client call http://www.example.com/test.html

 

 

Then the client will get the contend from the requestet side but with return code 210 and not with return code 200

 

 

 

Thanks for help

 

bjoern

6 Replies

  • here's how to do it, though I wasn't sure which code you wanted it changed to, so reverse them if I got it wrong.

     

     

    
    when HTTP_RESPONSE {
       if { [HTTP::status] == 210 } {
          HTTP::collect [HTTP::header Content-Length]
       }
    }
    when HTTP_RESPONSE_DATA {
       HTTP::respond 200 content [HTTP::payload]
    }
  • Out of curiosity, is 210 just an example? It's not defined in RFC2616 and I've never heard of it. Regardless, can you explain why you want to change the response that the app is responding with?

     

     

    Also, Citizen, wouldn't you have to handle chunked responses with no content length? It would be a shame to have to disable HTTP 1.1 on every server side connection just to collect the response and set the response status. I wonder if it might make sense to use a stream profile (without an HTTP profile), look for HTTP 210 and replace it with HTTP 200. It would be a bit of a hack...

     

     

    Aaron
  • our caching provieder is ask the status for the waintroom on our webservers with the status code 210
  • do i disable http 1.1 with this irule?

     

     

    backgroundinfo: apache can not handle a 210 returncode which cames from tomcat (include htlm code), but apache can handle 207, so i send a 207 from the tomcat to the apache and the apache send it to the F5
  • Hmmm, I'm not really an app guy, so I tend to forget about the details...good catch. I would try the stream profile myself, but you could also just collect X if the content-length header isn't there as detailed in this thread:

     

     

    http://devcentral.f5.com/default.aspx?tabid=53&view=topic&forumid=5&postid=10052

     

    Click here