post_action to a backend server

Rob Mueller robm at fastmail.fm
Tue Jan 27 05:03:16 MSK 2009


  As a follow up, is there any way to get the amount of data sent in the upstream request? I can then compare to content-length and see if the request completed successfully or not. I have proxy_set_header X-Original-Length $content_length, but this doesn't appear on the post_action whereas proxy_set_header X-Original-Uri $request_uri does.
You mean you want the number of bytes sent to the client? If so, then yes we do this with:

      proxy_set_header RateBytes $body_bytes_sent;

One thing to be aware of though, is that this is bytes sent by nginx. Your OS might have quite large TCP buffers, so nginx might send the whole response to the TCP buffers, but the client might kill the connection before it's all downloaded. I don't think there's any sane way of detecting that other than making your TCP buffers small (potential performance implications), or using some lower level tracking method.

Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090127/91da7039/attachment.html>


More information about the nginx mailing list