<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hello,
<div class=""><br class="">
</div>
<div class="">Would this kind of patch make sense to include in nginx upstream? If yes, then we would prepare it properly as an option (similar to <strong style="font-family: monospace; font-size: medium; line-height: 16px; widows: 1; background-color: rgb(242, 242, 242);" class="">proxy_pass_request_body</strong>).</div>
<div class=""><br class="">
</div>
<div class="">Use-case: at CERN we use nginx as a reverse proxy for Webdav/HTTP access to our large-scale storage system (<a href="https://eos.readthedocs.io" class="">https://eos.readthedocs.io</a>, <a href="https://eos.web.cern.ch" class="">https://eos.web.cern.ch</a>)
 and in particular for Sync&Share service called CERNBox (<a href="https://www.researchgate.net/publication/288020928_CERNBox_EOS_end-user_storage_for_science" class="">https://www.researchgate.net/publication/288020928_CERNBox_EOS_end-user_storage_for_science</a>).</div>
<div class=""><br class="">
</div>
<div class="">All client file transfer requests (PUT and GET) are first passed to a metadata upstream server which performs an (internal) redirect to a (calculated) storage node (http upstream server).</div>
<div class=""><br class="">
</div>
<div class="">In case of PUT we do not want and need to send the body to the metadata server but only to the storage node after internal X-Accel redirect. Hence, we have made this patch (on 1.6.2):</div>
<div class=""><br class="">
</div>
<div class="">
<pre class="highlight code" style="box-sizing: border-box; overflow-x: auto; overflow-y: hidden; font-family: Menlo, 'Liberation Mono', Consolas, 'DejaVu Sans Mono', 'Ubuntu Mono', 'Courier New', 'andale mono', 'lucida console', monospace; padding: 10px; margin-top: 0px; margin-bottom: 0px; word-break: break-all; word-wrap: normal; color: rgb(51, 51, 51); border-left-width: 1px; border-style: none none none solid; border-color: rgb(240, 240, 240); border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; text-shadow: none; widows: 1; background-color: rgb(255, 255, 255); font-size: 13px !important; line-height: 1.5 !important;"><code style="box-sizing: border-box; font-family: Menlo, 'Liberation Mono', Consolas, 'DejaVu Sans Mono', 'Ubuntu Mono', 'Courier New', 'andale mono', 'lucida console', monospace; font-size: inherit; padding: 0px; color: inherit; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-color: transparent;" class=""><span id="LC1" class="line" style="box-sizing: border-box; display: inline-block;"><span class="gd" style="box-sizing: border-box; color: rgb(0, 0, 0); background-color: rgb(255, 221, 221);">--- a/src/http/ngx_http_upstream.c 2015-01-27 16:24:56.000000001 +0100</span></span>
<span id="LC2" class="line" style="box-sizing: border-box; display: inline-block;"><span class="gi" style="box-sizing: border-box; color: rgb(0, 0, 0); background-color: rgb(221, 255, 221);">+++ b/src/http/ngx_http_upstream.c     2014-09-16 14:23:20.000000001 +0200</span></span>
<span id="LC3" class="line" style="box-sizing: border-box; display: inline-block;"><span class="gu" style="box-sizing: border-box; color: rgb(128, 0, 128); font-weight: bold;">@@ -525,8 +525,10 @@ ngx_http_upstream_init_request(ngx_http_</span></span>
<span id="LC4" class="line" style="box-sizing: border-box; display: inline-block;">         r->write_event_handler = ngx_http_upstream_wr_check_broken_connection;</span>
<span id="LC5" class="line" style="box-sizing: border-box; display: inline-block;">     }</span>
<span id="LC6" class="line" style="box-sizing: border-box; display: inline-block;"> </span>
<span id="LC7" class="line" style="box-sizing: border-box; display: inline-block;"><span class="gd" style="box-sizing: border-box; color: rgb(0, 0, 0); background-color: rgb(255, 221, 221);">-    if (r->request_body) {</span></span>
<span id="LC8" class="line" style="box-sizing: border-box; display: inline-block;"><span class="gd" style="box-sizing: border-box; color: rgb(0, 0, 0); background-color: rgb(255, 221, 221);">-        u->request_bufs = r->request_body->bufs;</span></span>
<span id="LC9" class="line" style="box-sizing: border-box; display: inline-block;"><span class="gi" style="box-sizing: border-box; color: rgb(0, 0, 0); background-color: rgb(221, 255, 221);">+    if (r->method != NGX_HTTP_PUT) {                                                                                                                               </span></span>
<span id="LC10" class="line" style="box-sizing: border-box; display: inline-block;"><span class="gi" style="box-sizing: border-box; color: rgb(0, 0, 0); background-color: rgb(221, 255, 221);">+      if (r->request_body) {                                                                                                                                      </span></span>
<span id="LC11" class="line" style="box-sizing: border-box; display: inline-block;"><span class="gi" style="box-sizing: border-box; color: rgb(0, 0, 0); background-color: rgb(221, 255, 221);">+      u->request_bufs = r->request_body->bufs;                                                                                                               </span></span>
<span id="LC12" class="line" style="box-sizing: border-box; display: inline-block;"><span class="gi" style="box-sizing: border-box; color: rgb(0, 0, 0); background-color: rgb(221, 255, 221);">+      } </span></span>
<span id="LC13" class="line" style="box-sizing: border-box; display: inline-block;">     }</span>
<span id="LC14" class="line" style="box-sizing: border-box; display: inline-block;"> </span>
<span id="LC15" class="line" style="box-sizing: border-box; display: inline-block;">     if (u->create_request(r) != NGX_OK) {</span></code></pre>
<div class=""><br class="">
</div>
</div>
<div class="">Thank you for your comments.</div>
<div class=""><br class="">
</div>
<div class="">Jakub Moscicki & Andreas Peters</div>
<div class=""><br class="">
</div>
</body>
</html>