[PATCH] Upstream: support named location for X-Accel-Redirect
Valentin V. Bartenev
vbart at nginx.com
Mon Nov 10 08:43:01 UTC 2014
On Monday 10 November 2014 09:54:13 Toshikuni Fukaya wrote:
> Hi,
>
> (2014/11/08 0:59), Igor Sysoev wrote:
> > On 04 Nov 2014, at 14:18, Toshikuni Fukaya <toshikuni-fukaya at cybozu.co.jp> wrote:
> >
> >> Upstream: support named location for X-Accel-Redirect.
> >
> > Could please you provide usage examples?
> >
> >
>
> Here is my (simplified) config:
>
> server {
> location / {
> proxy_pass http://app;
> }
>
> location @contents {
> proxy_pass http://contents/$upstream_http_x_contents_url;
> }
> }
>
> app is a upstream application server, it processes all client requests.
> contents is a some of blob server (like as S3) to supply images, css and
> so on.
>
> When clients access to nginx, app will check a some of ACL to such
> requests, then reply with x-accel-redirect and x-contents-url headers.
> Finally, nginx will return a content from contents upstream.
> In this time, x-accel-redirect will be set to @contents and
> x-contents-url will be an appropriate content url.
>
> The key of this strategy is that all requests is passed to app and can
> be checked by it.
> If location @contents is a normal location such as /contents, a client
> request to /contents will not be passed app. It is not comfortable for me.
Why don't you use the Auth Request module?
http://nginx.org/en/docs/http/ngx_http_auth_request_module.html
wbr, Valentin V. Bartenev
More information about the nginx-devel
mailing list