On 10 Nov 2014, at 03:54, Toshikuni Fukaya <toshikuni-fuk...@cybozu.co.jp> wrote:
> (2014/11/08 0:59), Igor Sysoev wrote: >> On 04 Nov 2014, at 14:18, Toshikuni Fukaya <toshikuni-fuk...@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. The "/contents” location can be marked as "internal", and it can not be accessed outside directly. However, using named location is more convenient for this example. Thank you. -- Igor Sysoev http://nginx.com _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel