Change HTTP method of Sub request

agentzh agentzh at gmail.com
Fri Mar 19 10:02:56 MSK 2010


On Fri, Mar 19, 2010 at 9:24 AM, W. Andrew Loe III <andrew at andrewloe.com> wrote:
> I have a Rails app that receives a POST and I would like to
> X-Accel-Redirect a file back to the client, but the fileserver is
> receiving a POST. Can I rewrite the HTTP method internally? I cannot
> find the documentation on this.

How about this?

    location /proxy {
          set_unescape_uri $body $arg_body;
          echo_subrequest_async POST /fileserver -b $body
     }

Then X-Accel-Redirect to /proxy?body=xxxx where xxxx is the content
body that you have read from within your PHP script.

Good luck :)
-agentzh



More information about the nginx mailing list