Nginx x-accel redirect named location uri
<p>I was using nginx x-accel-redirect as an authentication frontend for an external resource. </p>

<p>In my python code I would do the following: </p>

<p>/getresource/ </p>

<pre><code>def view(self, req, resp): 
    name = get_name(req.user.id) # authenticates request.
    resp.set_header('X-Accel-Redirect', '/resource/%s/' %name ) 
</code></pre>

<p>This would forward the HTTP method as well until nginx 1.10. 
Since nginx 1.10 all x-accel-redirects are forwarded as GET methods. </p>

<p>From this thread: 
<a href="https://forum.nginx.org/read.php?2,271372,271380#msg-271380" rel="nofollow noreferrer">https://forum.nginx.org/read.php?2,271372,271380#msg-271380</a> </p>

<p>I understand that the correct way to forward the HTTP method is to use named location. 
I am unable to find documentation on how this should be done. 
I tried the following: </p>

<pre><code>def view(self, req, resp): 
    name = get_name(req.user.id) 
    resp.set_header('X-Accel-Redirect', '@resource' ) 
</code></pre>

<p>but this redirects to "@resource /".</p>

<p>I would like to redirect to "@resource /name".</p>

<p>I also have asked this question on nginx forums:
<a href="https://forum.nginx.org/read.php?2,271448" rel="nofollow noreferrer">https://forum.nginx.org/read.php?2,271448</a></p>

<p>but no response yet.</p>

<p><strong>Edit:</strong></p>

<p>Posting configs for nginx</p>

<pre><code>location /getresource {
   proxy_pass http://127.0.0.1:8000;
}

location /resource {
    internal;
    proxy_pass http://127.0.0.1:8888;
}

location @resource {
    internal;
    proxy_pass http://127.0.0.1:8888;
}
</code></pre>