Reputation: 998
I have a node express app that is proxied by nginx. Nginx already handles most public static files, on /static
However, I have some files that need restricted access. After nginx proxies the HTTP request to my node app, on /restricted, I need to run my authorization logic and then, somehow, let nginx know that it should serve a specific file, from a directory that is not public.
I don't want to send the files directly from node as they are big and will block the main thread.
Upvotes: 1
Views: 73
Reputation: 49752
X-Accel-Redirect
HTTP response header which specifies a URI beginning with /restricted/
location
block containing an internal
directiveFor example:
location /restricted {
internal;
alias /path/to/files;
}
See this document for more.
Upvotes: 1