Authentication across node.js and nginx

2019-03-14 09:06发布

As most of my content is static i was planning to have nginx to handle the serving of static files. But the static content is also private. Different users have different content.

The application itself is written in node.js/express.js

And i was wondering how i should handle authentication/authorization. Is there anything, any nginx module for this.

Something like node.js put some token in memcached which nginx looks up upon request or something like that?

1条回答
三岁会撩人
2楼-- · 2019-03-14 10:00

Yes, there is such a feature, checkout the following more detailed articles:

All you have to do is to make a Node.js send the path of the file to NGiNX by setting the header "X-Accel-Redirect" with the location of that file.

查看更多
登录 后发表回答