Why Subrequests are get only?

Maxim Dounin mdounin at mdounin.ru
Mon Mar 4 13:33:18 UTC 2019


On Sun, Mar 03, 2019 at 09:33:57PM +0000, Maciej.Grochowski at sony.com wrote:

> I am trying to use mirror module for multiple requests, one usecase that I am interested in is sending PUT request to additional/mirror location.
> During that process I realized that PUT request became GET.
> When I took deeper look on subrequest function "ngx_http_subrequest(...)" I noticed that new request is always setup as GET.
> I was expecting behavior to be something like:


> What is the reason that I am missing and make Subrequests suitable for GET only requests?

Subrequests were originally developed to for the SSI include 
command, and they are expected to return content of a particular 
resource - that is, they are GET.

If you want them to act differently, you can modify the method 
after a subrequest is created and/or use the NGX_HTTP_SUBREQUEST_CLONE 

Maxim Dounin

More information about the nginx-devel mailing list