I have the following concern, i wrote an APP server in Java (Tomcat) that let people upload pictures to a MongoDB through GridFS. Once there i store the location to the application DB (Cassandra) and i send the location to the user any time is required by the context. Each user is authenticated by it's own JWT that i'm validating on APP server before sending the content JSON.
For performance reasons i'm planning to deploy the picture download to a faster server (checking the benchmarks i found out that using NGINX in front of a MongoDB is much faster than streaming files from Apache or Tomcat).
Here my concern, NGINX has GridFS module that let you serve data from MongoDB, but di-per-se NGINX is a proxy and therefore it can only server whatever my DB has. What if I would like to validate user's JWT from the 'image server' (NGINX) as well before serving the content? Is there any ready made module or any easy to implement solution?
Cheres guys, sorry if there is some confusion!