Forum Discussion

Pavlos_Parisis_'s avatar
Pavlos_Parisis_
Icon for Nimbostratus rankNimbostratus
Jun 09, 2010

Rewrite HTTP status

Hi,

 

 

I am using the following iRule in order to convent HTTP Status 200 to 206

 

when HTTP_RESPONSE {

 

grab response of a 200

 

if {[HTTP::status] == 200}{

 

log local0. "Got HTTP status 200"

 

HTTP::collect [HTTP::header Content-Length]

 

}

 

}

 

 

when HTTP_RESPONSE_DATA {

 

log local0. "change response to 206 and send"

 

HTTP::respond 206 content [HTTP::payload]

 

}

 

 

My problem is that my application doesn't receive all the data, it complains that the transfer is closed while there are remaining data to be read.

 

 

The flow of the traffic is the following

 

Step 1: HTTP get with Range header

 

Step 2: F5 forwards to a proxy

 

Step 3: Proxy1 generates another HTTP get with Range header

 

Step 4: F5 forwards to another proxy

 

Step 5: Proxy2 generates another HTTP get without Range header

 

Step 6: F5 forwards to the content server

 

Step 7: Content server responses with HTTP Status code 200

 

Step 8: F5 forwards the reply to Proxy2

 

Step 9: Proxy2 responses to Proxy1with HTTP Status code 200

 

Step 10: F5 forwards the reply to Proxy1

 

Step 11: Proxy1 replies to client with HTTP Status code 206.

 

Step 12: F5 forwards to client

 

 

Because at step 9 Proxy2 responses with HTTP Status code 200 while Proxy expect 206 I wrote the above iRule to convert at step 10 the with HTTP Status code 200 to 206. But, at step 11 Proxy1 complains about the remaining data.

 

 

Any idea what I am doing wrong?

 

 

Cheers,

 

Pavlos

 

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi Pavlos,

     

     

    If you're taking a 200 response from the origin server and sending default HTTP headers in a 206 response with the original payload, I can see that clients (or intermediate web proxies) would complain about this. RFC2616 describes specific response headers that must and should be set for 206 responses. I haven't done much testing with range requests/responses, but this is what I would guess.

     

     

    Why is Proxy2 stripping the range header in step 5? Can that behavior be changed? If so, you could eliminate the need for the iRule.

     

     

    Aaron
  • Hi hoolio,

     

     

    I know that I may break some rules from RFCs but I need to do it because Proxy2 stripes the range header in step 5. Furthermore, I want to do it just for troubleshooting an issue for which I need to find out if

     

    the return HTTP status code at step 9 is the root cause of it.

     

     

    Thanks for your post.

     

     

    Regards,

     

    Pavlos