Welcome! Log In Create A New Profile

Advanced

[PATCH] optionally avoid sending body of PUT request before X-Accel redirect

Jakub Moscicki
August 05, 2016 06:16AM
Hello,

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 proxy_pass_request_body).

Use-case: at CERN we use nginx as a reverse proxy for Webdav/HTTP access to our large-scale storage system (https://eos.readthedocs.io, https://eos.web.cern.ch) and in particular for Sync&Share service called CERNBox (https://www.researchgate.net/publication/288020928_CERNBox_EOS_end-user_storage_for_science).

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).

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):


--- a/src/http/ngx_http_upstream.c 2015-01-27 16:24:56.000000001 +0100
+++ b/src/http/ngx_http_upstream.c 2014-09-16 14:23:20.000000001 +0200
@@ -525,8 +525,10 @@ ngx_http_upstream_init_request(ngx_http_
r->write_event_handler = ngx_http_upstream_wr_check_broken_connection;
}

- if (r->request_body) {
- u->request_bufs = r->request_body->bufs;
+ if (r->method != NGX_HTTP_PUT) {
+ if (r->request_body) {
+ u->request_bufs = r->request_body->bufs;
+ }
}

if (u->create_request(r) != NGX_OK) {

Thank you for your comments.

Jakub Moscicki & Andreas Peters

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] optionally avoid sending body of PUT request before X-Accel redirect

Jakub Moscicki 697 August 05, 2016 06:16AM

Re: [PATCH] optionally avoid sending body of PUT request before X-Accel redirect

Maxim Dounin 300 August 06, 2016 10:42AM

Re: [PATCH] optionally avoid sending body of PUT request before X-Accel redirect

Jakub Moscicki 302 August 10, 2016 05:00AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 160
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready