Welcome! Log In Create A New Profile

Advanced

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

Jakub Moscicki
August 10, 2016 05:00AM
Hello,

Thank you for your suggestion. Experimenting I have stumbled on the config question:

What is the easiest way of *conditionally* adding "proxy_pass_request_body off” to a location? If method is PUT then I want to set: "proxy_pass_request_body off”.

I have quite a complex location block which I would like to avoid to copy/paste in my configuration.

I would like to do something like this:

location ~/my-uri(*.) {

if ($request_method = PUT) {
proxy_pass_request_body off;
}
… complex and long location handler ...
}


The only way I imagined so far is with conditional rewrite in front of my original location - but that complicates my config file a lot with huge copy/paste blocks. Something like that:

location ~ ^my-uri(*.) {
if ($request_method = PUT) {
rewrite ^ /internal_location_put$1;
}
rewrite ^ /internal_location_other$1;
}

location ~ ^/internal_location_put(.*) {
proxy_pass_request_body off;
… complex and long location handler ...
}

location ~ ^/internal_location_other(.*) {
… complex and long location handler ...
}

Thank you,

kuba

--

> On 06 Aug 2016, at 16:39, Maxim Dounin <mdounin@mdounin.ru> wrote:
>
> Hello!
>
> On Fri, Aug 05, 2016 at 10:14:36AM +0000, Jakub Moscicki wrote:
>
>> 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):
>
> Consider using "proxy_pass_request_body off" instead, see
> http://nginx.org/r/proxy_pass_request_body.
>
> --
> Maxim Dounin
> http://nginx.org/
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel

_______________________________________________
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 698 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: 150
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